From cae111b2fa2515539e7de377a0d7b75914e724ef Mon Sep 17 00:00:00 2001 From: Gabriele Pongelli Date: Mon, 30 Mar 2020 20:45:11 +0200 Subject: [PATCH] Check crontab to avoid adding the job multiple times --- openvpn/start.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openvpn/start.sh b/openvpn/start.sh index be56467eb..a7db432d3 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -63,8 +63,12 @@ then # Add daily update to cron crontab -l > tempcron - echo "0 1 * * * /etc/openvpn/updateFreeVPN.sh" > tempcron - crontab tempcron + + grep updateFreeVPN tempcron > /dev/null 2>&1 + if [[ $? == 1 ]]; then + echo "0 1 * * * /etc/openvpn/updateFreeVPN.sh" > tempcron + crontab tempcron + fi rm tempcron elif [[ "${OPENVPN_PROVIDER^^}" = "VPNBOOK" ]] then