[root@nfs01 ~]# cat /etc/init.d/syncd
    #!/bin/bash
    #chkconfig: 2345 28 46
    #Descript: This is inotify backup server scripts
    #Author: By WeiTianwu QQ:1259018888 && 2016/10/15 21:26:22

    export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

    . /etc/init.d/functions

    if [ $# -ne 1 ];then
    usage: $0 {start|stop}
    exit 1
    fi

    case “$1” in
    start)
    /bin/bash /server/scripts/inotify.sh &
    echo $$ >/var/run/inotify.pid
    if [ ps -ef|grep inotify|wc -l -gt 2 ];then
    action “inotify service is started” /bin/true
    else
    action “inotify service is started” /bin/false
    fi
    ;;

    stop)
    kill -9 cat /var/run/inotify.pid >/dev/null 2>&1
    pkill inotifywait
    sleep 1
    if [ ps -ef|grep inotify|grep -v grep|wc -l -eq 0 ];then
    action “inotify service is stopped” /bin/true
    else
    action “inotify service is stopped” /bin/false
    fi
    ;;

    *)
    usage: $0 {start|stop}
    exit 1

    esac