123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #!/bin/bash
- #
- # lsyncd
- #
- # chkconfig: - 99 20
- # processname: /usr/bin/lsyncd
- # description: Live syncing daemon
- ### BEGIN INIT INFO
- # Provides: lsyncd
- # Required-Start: $syslog $local_fs
- # Required-Stop: $syslog $local_fs
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: start and stop lsyncd
- # Description: Live syncing daemon
- ### END INIT INFO
- #
- DAEMON=/usr/bin/lsyncd
- prog=`basename $DAEMON`
- CONFIG=/etc/lsyncd.conf.xml
- PIDFILE=/var/lock/subsys/lsyncd
- test -e $DAEMON || exit 0
- test -f $CONFIG || exit 0
- if [ -r /etc/init.d/functions ]; then
- . /etc/init.d/functions
- fi
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- export PATH
- RETVAL=0
- start() {
- # Check if it is already running
- if [ ! -f $PIDFILE ]; then
- echo -n $"Starting lsyncd daemon: "
- daemon /usr/bin/lsyncd --pidfile $PIDFILE --conf $CONFIG
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch $PIDFILE
- echo
- fi
- return $RETVAL
- }
- stop() {
- echo -n $"Stopping lsyncd daemon: "
- killproc /usr/bin/lsyncd
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f $PIDFILE
- echo
- return $RETVAL
- }
- restart() {
- stop
- start
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- condrestart)
- if [ -f $PIDFILE ]; then
- restart
- fi
- ;;
- status)
- status lsyncd
- RETVAL=$?
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- RETVAL=2
- esac
- exit $RETVAL
|