diff options
author | Stu Miller <slackbuilds@go4it2day.com> | 2018-05-23 07:19:53 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-05-23 07:19:53 +0700 |
commit | c4318caa5f678d72065cfb84661420017e6d896d (patch) | |
tree | 0558605d44b4bfbdde1a5657e282664856aeb882 /audio/clockchimes/doinst.sh | |
parent | a2ffb4cbe7f5f5cf4912d8a4783ba87a39959255 (diff) | |
download | slackbuilds-c4318caa5f678d72065cfb84661420017e6d896d.tar.gz |
audio/clockchimes: Updated for version 0.3.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'audio/clockchimes/doinst.sh')
-rw-r--r-- | audio/clockchimes/doinst.sh | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/audio/clockchimes/doinst.sh b/audio/clockchimes/doinst.sh index 8aa71f082f..58ef63dfce 100644 --- a/audio/clockchimes/doinst.sh +++ b/audio/clockchimes/doinst.sh @@ -14,30 +14,24 @@ config() { } config etc/clockchimes.conf.new +config etc/cron.d/clockchimes.new -# root crontab missing? -if [ ! -e /var/spool/cron/crontabs/root ]; then - # true: crontab missing, create crontab and set permissions - touch /var/spool/cron/crontabs/root - chmod 0600 /var/spool/cron/crontabs/root -fi # END crontab missing +# clean root crontab from versions before v0.3 +grep 'clockchimes' /var/spool/cron/crontabs/root 1>/dev/null +if [ $? -eq 0 ]; then + grep -v 'clockchimes' > /var/spool/cron/crontabs/root +fi # END clean root crontab -# root crontab not updated? -grep "# clockchimes" /var/spool/cron/crontabs/root 1> /dev/null -if [ $? -ne 0 ]; then - # true: crontab not updated, update with clockchimes - cat << EOF >> /var/spool/cron/crontabs/root -# clockchimes -0,15,30,45 * * * * /usr/bin/clockchimes 1> /dev/null -EOF +# kill crond if running +ps -C crond 1>/dev/null +if [ $? -eq 0 ]; then + # true: kill crond + killall crond 1>/dev/null +fi # END crond running - # crond running? - ps -C crond 1>/dev/null - if [ $? -eq 0 ]; then - # true: crond running, reload crond - crontab /var/spool/cron/crontabs/root 1> /dev/null - else - # false: crond not running, start crond - /usr/sbin/crond -l notice - fi # END crond running -fi # END crontab not updated +# start crond if not running +ps -C crond 1>/dev/null +if [ $? -ne 0 ]; then + # true: start crond + /usr/sbin/crond -l notice +fi # END crond running |