Here is how I fail over application account cronjobs using VCS.
Application Appx_cronjobs
(
Critical = 0ff
StartProgram = "/usr/bin/su - appxusr -c "touch ./crontab.LAST""
StopProgram = "/usr/bin/su - appxusr -c "/usr/bin/rm -f ./crontab.LAST""
CleanProgram = "/usr/bin/su - appxusr -c "/usr/bin/rm -f ./crontab.LAST""
MonitorProgram = "/usr/bin/su appsusr -c /etc/VRTSvcs/utils/vcs_cron_monitor.sh" )
# vcs_cron_monitor.sh Script.
#!/bin/ksh
ME=`/usr/ucb/whoami` MYHOME=`echo ~${ME}` MYHOST=`uname -n`
if [ "${MYHOME}xx" = "xx" ] then exit 100 fi
if [ ! -d $MYHOME -o ! -f $MYHOME/crontab.LAST ]; then exit 100 fi
SAVEHOST=`cat $MYHOME/crontab.LAST` if [ $SAVEHOST != $MYHOST ] then crontab $MYHOME/crontab.bak fi
echo $MYHOST > $MYHOME/crontab.LAST crontab -l > $MYHOME/crontab.bak
exit 110
About Danny W Sheehan
Danny has over 25 years in the IT industry and loves to blog about how to setup computer software, hardware, electronics and gadgets in general.
Link to this post!




No comments yet.