1
0
mirror of https://github.com/namibia/demo-sync.git synced 2024-11-22 03:25:09 +00:00

fixed no cron set for user error

This commit is contained in:
Llewellyn van der Merwe 2017-07-05 23:47:08 +01:00
parent a7eb9fb07f
commit 17fe31bfb9
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5

View File

@ -7,8 +7,8 @@ function getKey () {
# Variables # Variables
TRUE=1 TRUE=1
VDMUSER="vdm" VDMUSER="llewellyn"
VDMHOME="/home/vdm" VDMHOME="/home/llewellyn"
VDMSCRIPT="https://raw.githubusercontent.com/vdm-io/dynamic-ip/$BRANCH/setip.sh" VDMSCRIPT="https://raw.githubusercontent.com/vdm-io/dynamic-ip/$BRANCH/setip.sh"
VDMIPSERVER="https://www.vdm.io/setip" VDMIPSERVER="https://www.vdm.io/setip"
@ -24,8 +24,14 @@ if [ -f $VDMHOME/vdmip.cron ]; then
echo "Crontab already configured for updates...Skipping" echo "Crontab already configured for updates...Skipping"
else else
echo -n "Adding crontab entry for continued updates..." echo -n "Adding crontab entry for continued updates..."
currentCron=$(crontab -u $VDMUSER -l) # check if user crontab is set
currentCron=$(crontab -u $VDMUSER -l 2>/dev/null)
if [[ -z "${currentCron// }" ]]; then
currentCron="# VDM crontab settings"
echo "$currentCron" > $VDMHOME/vdmip.cron echo "$currentCron" > $VDMHOME/vdmip.cron
else
echo "$currentCron" > $VDMHOME/vdmip.cron
fi
# check if the MAILTO is already set # check if the MAILTO is already set
if [[ $currentCron != *"MAILTO"* ]]; then if [[ $currentCron != *"MAILTO"* ]]; then
echo "MAILTO=\"\"" >> $VDMHOME/vdmip.cron echo "MAILTO=\"\"" >> $VDMHOME/vdmip.cron