-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheizungd.sh
62 lines (52 loc) · 1.33 KB
/
heizungd.sh
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
#!/bin/bash
#
# Daemonn Name: heizungd
#
# chkconfig: - 58 74
# description: Scipt handles the heizung daemon
# author: Henry Leinen
# Source function library.
. /lib/lsb/init-functions
# The directory in which to find the daemon script or executable
DIR=/usr/local/bin/heizung
# The daemon script or executable
DAEMON=$DIR/heizungd
# The name of the daemon
DAEMON_NAME=heizungd
# The next line determines what user the script runs as.
# Root generally not recommended but necessary if you are using the Raspberry Pi GPIO.
DAEMON_USER=root
# The process ID of the script when it runs is stored here
PIDFILE=/var/run/$DAEMON_NAME.pid
# Any options we want to pass to the daemon
DAEMON_OPTS=$PIDFILE
do_start() {
# Start our daemon daemon
echo -n $"Starting system daemon $prog."
start-stop-daemon --start --pidfile "$PIDFILE" --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON --exec $DAEMON -- $DAEMON_OPTS
log_end_msg $?
RETVAL=$?
}
do_stop() {
echo -n $"Stopping system daemon $prog."
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
RETVAL=$?
}
# See how we were called.
case "$1" in
start|stop)
do_${1}
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
;;
restart|reload|force-reload)
do_stop
do_start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit 0