summaryrefslogtreecommitdiff
path: root/audio/clockchimes/doinst.sh
diff options
context:
space:
mode:
authorStu Miller <slackbuilds@go4it2day.com>2018-03-29 21:45:42 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-03-31 07:41:40 +0700
commitd8b9a2aa1dc3f9cac43f44e778260da8fb9e7679 (patch)
tree483078ec4e377c476d8848e949fb267848942f64 /audio/clockchimes/doinst.sh
parent19ce57e63c909504c098282fc22e73ca4371a136 (diff)
downloadslackbuilds-d8b9a2aa1dc3f9cac43f44e778260da8fb9e7679.tar.gz
audio/clockchimes: Added (plays clock chimes).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'audio/clockchimes/doinst.sh')
-rw-r--r--audio/clockchimes/doinst.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/audio/clockchimes/doinst.sh b/audio/clockchimes/doinst.sh
new file mode 100644
index 0000000000..30a7850b47
--- /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