#!/bin/sh start() { if ps | grep inotifywait | grep -v grep > /dev/null; then echo "inotifywait running - kill and restart" killall inotifywait sleep 1 fi echo "starting inotifywait" inotifywait -c -r -m / \ @/dev @/proc @/var @/rom @/sto \ --exclude 'busybox|uClibc|libcrypt-0' \ >> /var/iw.log 2> /dev/null & sleep 3 } case "$1" in ""|load|start) start ;; status) if ps | grep inotifywait | grep -v grep > /dev/null; then echo "running" else echo "stopped" fi ;; stop) echo "stopping inotifywait" killall inotifywait ;; *) echo "Usage: $0 [load|start|status|stop]" 1>&2 exit 1 ;; esac exit 0