-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotify.debian-init
67 lines (58 loc) · 1.61 KB
/
notify.debian-init
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: notify
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Notify daemon
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
. /lib/lsb/init-functions
NAME=notify
DAEMON=/usr/local/sbin/$NAME
PIDFILE=/var/lib/$NAME/$NAME.pid
RUNASUSER=$NAME
if [ -f /etc/default/$NAME ]; then
. /etc/default/$NAME
fi
UID=$(getent passwd $RUNASUSER | cut -f 5,4 -d:) || true
if test "$(uname -s)" = "Linux"; then
NOTIFY_OPTS="$NOTIFY_OPTS --user $RUNASUSER --daemon --pidfile $PIDFILE"
fi
test -f $DAEMON || exit 0
case $1 in
start)
log_daemon_msg "Starting Notify daemon" "notify"
if [ -z "$UID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
fi
start-stop-daemon --start --pidfile $PIDFILE -u $RUNASUSER --startas $DAEMON -- $NOTIFY_OPTS
status=$?
log_end_msg $status
;;
stop)
log_daemon_msg "Stopping Notify server" "notify"
start-stop-daemon --stop --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
;;
restart)
$0 stop && sleep 2 && $0 start
;;
reload)
log_daemon_msg "Reloading notify configuration" "notify"
kill -HUP `cat $PIDFILE` &>/dev/null
log_end_msg $?
;;
status)
status_of_proc $DAEMON "Notify server"
exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 4
;;
esac
exit 0