diff options
Diffstat (limited to 'audio/clockchimes/doinst.sh')
-rw-r--r-- | audio/clockchimes/doinst.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/audio/clockchimes/doinst.sh b/audio/clockchimes/doinst.sh new file mode 100644 index 000000000000..30a7850b470b --- /dev/null +++ b/audio/clockchimes/doinst.sh @@ -0,0 +1,27 @@ +# doinst.sh for clockchimes +# focus is on making sure cron is managing clockchime script + +# negative test: check if root crontab exists +if [ ! -e /var/spool/cron/crontabs/root ]; then + # true: does not exist, create root crontab and set permissions + touch /var/spool/cron/crontabs/root + chmod 0600 /var/spool/cron/crontabs/root +fi + +# negative test: check if root crontab previously modified +grep "# clockchimes" /var/spool/cron/crontabs/root 1> /dev/null +if [ $? -ne 0 ]; then + +# true: not previously modified +cat << EOF >> /var/spool/cron/crontabs/root +# clockchimes +0,15,30,45 * * * * /usr/bin/clockchimes.sh 1> /dev/null +EOF + + # positive test: check if crond is running + ps -C crond 1>/dev/null + if [ $? -eq 0 ]; then + # true: reload crond + crontab /var/spool/cron/crontabs/root 1> /dev/null + fi +fi |