summaryrefslogtreecommitdiff
path: root/system/incron/rc.incrond
diff options
context:
space:
mode:
authorMarek Srejma <sam_web@yahoo.de>2017-04-30 21:36:22 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-04-30 21:36:22 +0700
commit7000ec52a66a66af713a3b53638c312b4a2def5e (patch)
tree9a4eb6231c2baeef4515e0dbf1b8c322d9584071 /system/incron/rc.incrond
parentad1a1d82ce65a9a1b79ac9c2bd73cabd867e1a35 (diff)
downloadslackbuilds-7000ec52a66a66af713a3b53638c312b4a2def5e.tar.gz
system/incron: Updated for version 0.6.0 + new maintainer.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/incron/rc.incrond')
-rw-r--r--system/incron/rc.incrond62
1 files changed, 62 insertions, 0 deletions
diff --git a/system/incron/rc.incrond b/system/incron/rc.incrond
new file mode 100644
index 0000000000..752d930c46
--- /dev/null
+++ b/system/incron/rc.incrond
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Start/stop/restart the inotify cron daemon (incrond).
+
+# Sanity check. If /usr/sbin/incrond is missing then it
+# doesn't make much sense to try to run this script:
+if [ ! -x /usr/sbin/incrond ]; then
+ printf "%s: no /usr/sbin/incrond found (or not executable); cannot start.\n" "$0"
+ exit 1
+fi
+
+# Check if incrond is running
+incrond_running() {
+ ps axc | egrep -q " incrond$"
+}
+
+# Start incrond.
+incrond_start() {
+ incrond_running && {
+ echo "incrond is already running."
+ } || {
+ echo "Starting incrond: /usr/sbin/incrond"
+ /usr/sbin/incrond
+ }
+}
+
+# Stop incrond (/usr/sbin/incrond):
+incrond_stop() {
+ incrond_running && {
+ echo "Stopping incrond: /usr/sbin/incrond -k"
+ /usr/sbin/incrond -k
+ } || {
+ echo "incrond is not running."
+ }
+}
+
+# Restart incrond:
+incrond_restart() {
+ incrond_stop
+ incrond_start
+}
+
+case "$1" in
+ 'start')
+ incrond_start
+ ;;
+ 'stop')
+ incrond_stop
+ ;;
+ 'restart')
+ incrond_restart
+ ;;
+ 'status')
+ incrond_running && {
+ echo "incrond is running."
+ } || {
+ echo "No running incrond process."
+ }
+
+ ;;
+ *)
+ printf "usage:\n\t%s start|stop|restart|status\n" "$0"
+esac