diff options
Diffstat (limited to 'system/incron/rc.incrond')
-rw-r--r-- | system/incron/rc.incrond | 62 |
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 |