add init script

pull/135/head
Michael Zanetti 2014-10-03 11:35:29 +02:00 committed by Michael Zanetti
parent 988ef98141
commit ebc0a83027
2 changed files with 65 additions and 0 deletions

63
data/init/guhd Normal file
View File

@ -0,0 +1,63 @@
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d. This example start a
# single forking daemon capable of writing a pid
# file. To get other behavoirs, implemend
# do_start(), do_stop() or other functions to
# override the defaults in /lib/init/init-d-script.
### END INIT INFO
# Author: Michael Zanetti <micha@guh.guru>
DESC="guh daemon"
case "$1" in
start)
log_daemon_msg "Starting guh daemon" "guh" || true
if start-stop-daemon --start --background --quiet --oknodo -m --pidfile /var/run/guh.pid --exec /usr/bin/guh -- $GUH_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
stop)
log_daemon_msg "Stopping guh daemon" "guh" || true
if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/guh.pid; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
restart)
check_for_upstart 1
check_privsep_dir
check_config
log_daemon_msg "Restarting guh daemon" "guh" || true
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/guh.pid
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --background --quiet --oknodo -m --pidfile /var/run/guh.pid --exec /usr/bin/guh -- $GUH_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
*)
log_action_msg "Usage: /etc/init.d/guhd {start|stop|restart}" || true
exit 1
esac
exit 0

2
debian/guh.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/bin/guh
data/init/guhd /etc/init.d/guhd