OPSTATE_OFFLINE=2 Action=${1} case ${Action} in ........start) ..........nohup bash /root/syncup/syncup.sh >> syncup.log 2>&1 & ..........logger -i -t "SAM-inotify" "inotify started" ..........RC=0 ..........;; ........stop) ..........killall inotifywait ..........logger -i -t "SAM-inotify" "inotify stopped" ..........RC=0 ..........;; ........status) ..........ps ax |grep -v "grep"| grep inotifywait>/dev/null ..........if [ $? == 0 ] ..........then ............RC=${OPSTATE_ONLINE} ..........else ............RC=${OPSTATE_OFFLINE} ..........fi ..........;; esac exit $RC 

Create a definition file with name inotify.def  on the dsm-master node. The directory highlighted in 3. bold in the following example is the directory where inotify  is created. Save the file in the same directory where the inotify  script was saved in a previous step. In this example, that directory is /etc/init.d . 

[root@dsm-master init.d]# cat inotify.def PersistentResourceAttributes:: ....Name="inotify" ....StartCommand=" /etc/init.d /inotify start" ....StopCommand=" /etc/init.d /inotify stop" ....MonitorCommand=" /etc/init.d /inotify status" ....MonitorCommandPeriod=5 ....MonitorCommandTimeout=5 ....NodeNameList={"dsm-master"} ....StartCommandTimeout=10 ....StopCommandTimeout=10 ....UserName="root" ....ResourceType=0 

Create a definition file with name inotify2.def  on the dsm-backup node. The directory in bold is 4. where inotify  is created. Save the file in the same directory where the inotify  script was saved in a previous step. In this example, that directory is /etc/init.d . 

[root@dsm-master init.d]# cat inotify2.def PersistentResourceAttributes:: ....Name="inotify2" ....StartCommand=" /etc/init.d /inotify start" ....StopCommand=" /etc/init.d /inotify stop" ....MonitorCommand=" /etc/init.d /inotify status" ....MonitorCommandPeriod=5 ....MonitorCommandTimeout=5 ....NodeNameList={"dsm-backup"} ....StartCommandTimeout=10 

