1
0
mirror of https://github.com/namibia/demo-sync.git synced 2024-11-21 19:15:10 +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
TRUE=1
VDMUSER="vdm"
VDMHOME="/home/vdm"
VDMUSER="llewellyn"
VDMHOME="/home/llewellyn"
VDMSCRIPT="https://raw.githubusercontent.com/vdm-io/dynamic-ip/$BRANCH/setip.sh"
VDMIPSERVER="https://www.vdm.io/setip"
@ -24,8 +24,14 @@ if [ -f $VDMHOME/vdmip.cron ]; then
echo "Crontab already configured for updates...Skipping"
else
echo -n "Adding crontab entry for continued updates..."
currentCron=$(crontab -u $VDMUSER -l)
echo "$currentCron" > $VDMHOME/vdmip.cron
# 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
else
echo "$currentCron" > $VDMHOME/vdmip.cron
fi
# check if the MAILTO is already set
if [[ $currentCron != *"MAILTO"* ]]; then
echo "MAILTO=\"\"" >> $VDMHOME/vdmip.cron