123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- #! /bin/sh
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- DESC="Klish configuration daemon"
- NAME=gluff
- DAEMON=/usr/sbin/$NAME
- PIDFILE=/var/run/$NAME.pid
- SCRIPTNAME=/etc/init.d/$NAME
- [ -x "$DAEMON" ] || exit 0
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
- . /lib/init/vars.sh
- . /lib/lsb/init-functions
- DAEMON_ARGS="-l $QUEUE_DB -h $MYSQL_HOST -u $MYSQL_USER -p $MYSQL_PASSWD -d $MYSQL_DB $OPTIONS"
- do_start()
- {
- log_daemon_msg "Starting $DESC" "$NAME"
- start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARGS
- ps -fe | grep $DAEMON | head -n1 | cut -d" " -f 6 > ${PIDFILE}
-
- log_end_msg $?
- }
- do_stop()
- {
- log_daemon_msg "Stopping $DESC" "$NAME"
- start-stop-daemon --stop --quiet --pidfile "$PIDFILE"
- log_end_msg $?
- rm -f "$PIDFILE"
- }
- do_reload() {
-
-
-
-
-
- start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
- return 0
- }
- case "$1" in
- start)
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- stop)
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
- ;;
-
-
-
-
-
-
-
-
-
- restart|force-reload)
-
-
-
-
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;;
- *) log_end_msg 1 ;;
- esac
- ;;
- *)
-
- log_end_msg 1
- ;;
- esac
- ;;
- *)
-
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
- esac
- :
|