12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #!/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/lsyncd.conf.lua
- DAEMON_ARGS="${CONFIG}"
- PIDFILE=/var/run/${prog}.pid
- LOCKFILE=/var/lock/subsys/${prog}
- [ -x "$DAEMON" ] || exit 0
- [ -r "$CONFIG" ] || exit 0
- if [ -r /etc/init.d/functions ]; then
- . /etc/init.d/functions
- fi
- if [ -r /etc/sysconfig/${prog} ]; then
- . /etc/sysconfig/${prog}
- 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 $prog: "
- daemon --pidfile=$PIDFILE $DAEMON $CONFIG
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch $LOCKFILE
- echo
- fi
- return $RETVAL
- }
- stop() {
- echo -n $"Stopping $prog: "
- killproc -p "${PIDFILE}" $DAEMON
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
- 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
|