doinst.sh 950 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # doinst.sh for clockchimes
  2. config() {
  3. NEW="$1"
  4. OLD="$(dirname $NEW)/$(basename $NEW .new)"
  5. # If there's no config file by that name, mv it over:
  6. if [ ! -r $OLD ]; then
  7. mv $NEW $OLD
  8. elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
  9. # toss the redundant copy
  10. rm $NEW
  11. fi
  12. # Otherwise, we leave the .new copy for the admin to consider...
  13. }
  14. config etc/clockchimes.conf.new
  15. config etc/cron.d/clockchimes.new
  16. # clean root crontab from versions before v0.3
  17. grep 'clockchimes' /var/spool/cron/crontabs/root 1>/dev/null
  18. if [ $? -eq 0 ]; then
  19. grep -v 'clockchimes' > /var/spool/cron/crontabs/root
  20. fi # END clean root crontab
  21. # kill crond if running
  22. ps -C crond 1>/dev/null
  23. if [ $? -eq 0 ]; then
  24. # true: kill crond
  25. killall crond 1>/dev/null
  26. fi # END crond running
  27. # start crond if not running
  28. ps -C crond 1>/dev/null
  29. if [ $? -ne 0 ]; then
  30. # true: start crond
  31. /usr/sbin/crond -l notice
  32. fi # END crond running