-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsiahsd-init-script
executable file
·58 lines (51 loc) · 1.21 KB
/
siahsd-init-script
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
#! /bin/sh
# /etc/init.d/siahsd
#
# Written by Wilco Baan Hofman <[email protected]>
### BEGIN INIT INFO
# Provides: siahsd
# Required-Start: $network
# Required-Stop: $network
# Should-Start: postgresql mysql
# Should-Stop: postgresql mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SIA-HS Daemon
# Description: SIA-HS Daemon
### END INIT INFO
DAEMON=/usr/local/src/siahsd/build/siahsd
DAEMON_ARGS=
USER=siahsd
PIDFILE=/var/run/siahsd.pid
start() {
echo -n "Starting SIA-HS Daemon: "
touch "$PIDFILE"
chown "$USER": "$PIDFILE"
if start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USER" --exec "$DAEMON" -- $DAEMON_ARGS; then
echo "siahsd."
else
echo "FAILED."
return 1
fi
}
stop() {
echo -n "Stopping SIA-HS Daemon: "
if start-stop-daemon --stop --quiet --chuid "$USER" --retry=TERM/30/KILL/5 --pidfile "$PIDFILE" --exec "$DAEMON"; then
echo "siahsd."
else
echo "FAILED."
return 1
fi
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
esac