mirror of
https://github.com/namibia/demo-sync.git
synced 2024-11-24 20:27:33 +00:00
fixed no cron set for user error
This commit is contained in:
parent
a7eb9fb07f
commit
17fe31bfb9
14
setip.sh
14
setip.sh
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user