File: onak.init

package info (click to toggle)
onak 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,788 kB
  • ctags: 819
  • sloc: ansic: 12,323; perl: 301; sh: 283; makefile: 179; sql: 21
file content (78 lines) | stat: -rw-r--r-- 2,086 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
### BEGIN INIT INFO
# Provides:          onak 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 <noodles@earth.li>

# 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.ini; 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

: