slackbuilds_ponce/audio/clockchimes/doinst.sh
Stu Miller c4318caa5f audio/clockchimes: Updated for version 0.3.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2018-05-23 07:19:53 +07:00

37 lines
950 B
Bash

# doinst.sh for clockchimes
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
config etc/clockchimes.conf.new
config etc/cron.d/clockchimes.new
# 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
# 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
# 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