-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyserver.initd
56 lines (49 loc) · 1.13 KB
/
keyserver.initd
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
#!/bin/sh
# /etc/init.d/keyserver
#
set -e
PREFIX=/usr/local
NAME=keyserver
DAEMON=$PREFIX/bin/$NAME
# include defaults if available
if [ -f /etc/default/$NAME ]; then
. /etc/default/$NAME
fi
if [ -z $PORT ]; then
echo "No port given. Using default"
PORT=8000
fi
if [ -z $DAEMON_USER ]; then
DAEMON_USER=nobody
fi
case "$1" in
start)
echo -n "Starting $NAME: "
start-stop-daemon --start --quiet --background --make-pidfile \
--pidfile /var/run/$NAME.pid \
--chuid $DAEMON_USER --exec $DAEMON -- $PORT
echo "$NAME."
;;
stop)
echo "Stopping $NAME: "
start-stop-daemon --stop --quiet --background \
--pidfile /var/run/$NAME.pid --chuid $DAEMON_USER \
--exec $DAEMON
echo "$NAME."
;;
restart)
echo "Restarting $NAME: "
start-stop-daemon --stop --quiet --background \
--pidfile /var/run/$NAME.pid --chuid $DAEMON_USER \
--exec $DAEMON
sleep 5
start-stop-daemon --start --quiet --background --make-pidfile \
--pidfile /var/run/$NAME.pid \
--chuid $DAEMON_USER --exec $DAEMON -- $PORT
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0