Check crontab to avoid adding the job multiple times

This commit is contained in:
Gabriele Pongelli
2020-03-30 20:45:11 +02:00
parent 76192c4a2a
commit cae111b2fa

View File

@@ -63,8 +63,12 @@ then
# Add daily update to cron # Add daily update to cron
crontab -l > tempcron 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 rm tempcron
elif [[ "${OPENVPN_PROVIDER^^}" = "VPNBOOK" ]] elif [[ "${OPENVPN_PROVIDER^^}" = "VPNBOOK" ]]
then then