55 lines
1.1 KiB
Bash
Executable file
55 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: gowiki
|
|
# Required-Start: $syslog $network
|
|
# Required-Stop: $syslog
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: GoWiki
|
|
# Description: GoWiki
|
|
### END INIT INFO
|
|
|
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
|
DESC="wiki engine"
|
|
NAME=gowiki
|
|
DAEMON=/usr/bin/${NAME}
|
|
DAEMON_OPTS="-s"
|
|
PID=$(ps aux|grep "${DAEMON}"|awk '!/grep/{print $2}')
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
do_start() {
|
|
${DAEMON} ${DAEMON_OPTS}
|
|
log_end_msg ${?}
|
|
}
|
|
|
|
do_stop() {
|
|
kill ${PID}
|
|
return "${?}"
|
|
}
|
|
|
|
case "${1}" in
|
|
start)
|
|
log_action_msg "Starting ${DESC}" "${NAME}"
|
|
do_start
|
|
;;
|
|
stop)
|
|
log_daemon_msg "Stopping ${DESC}" "${NAME}"
|
|
do_stop
|
|
;;
|
|
restart)
|
|
log_daemon_msg "Restarting ${DESC}" "${NAME}"
|
|
do_stop
|
|
if [ ${?} -ne 0 ]; then
|
|
log_end_msg 1
|
|
fi
|
|
do_start
|
|
;;
|
|
status)
|
|
status_of_proc -p ${PID} "${DAEMON}" "${NAME}" && exit 0 || exit ${?}
|
|
;;
|
|
*)
|
|
echo "Usage: service ${NAME} {start|stop|restart|status}"
|
|
exit 3
|
|
;;
|
|
esac
|