blob: 8aa71f082f8ef2e5742d2dff65c5b5504d7ca71b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# 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
# 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
# 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
# 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
|