#!/bin/sh ### BEGIN INIT INFO # Provides: pgp-keyserver # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: onak init script # Description: onak is a PGP keyserver with an optional persistent # backend daemon which this script starts. ### END INIT INFO # Author: Jonathan McDowell # Do NOT "set -e" PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="PGP Keyserver backend" NAME=keyd DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/onak # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. . /lib/lsb/init-functions if ! grep -q -E '^use_keyd *(true|yes|1)$' /etc/onak.conf; then exit 0 fi case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" start-stop-daemon --start --oknodo --user onak --chuid onak \ --exec $DAEMON case "$?" in 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" /usr/bin/keydctl quit start-stop-daemon --stop --oknodo --user onak --exec $DAEMON case "$?" in 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; restart|force-reload) [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME" /usr/bin/keydctl quit start-stop-daemon --stop --oknodo --user onak --exec $DAEMON start-stop-daemon --start --oknodo --user onak --chuid onak \ --exec $DAEMON case "$?" in 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 exit 3 ;; esac :