diff --git a/data/init/guhd b/data/init/guhd new file mode 100644 index 00000000..e7a8a48d --- /dev/null +++ b/data/init/guhd @@ -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 + +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 + diff --git a/debian/guh.install b/debian/guh.install new file mode 100644 index 00000000..e814c467 --- /dev/null +++ b/debian/guh.install @@ -0,0 +1,2 @@ +usr/bin/guh +data/init/guhd /etc/init.d/guhd