43 # |
43 # |
44 # Function that starts the daemon/service |
44 # Function that starts the daemon/service |
45 # |
45 # |
46 do_start() |
46 do_start() |
47 { |
47 { |
48 su - brewery -c "$DAEMON" >/dev/null 2>/dev/null |
48 # Return |
|
49 # 0 if daemon has been started |
|
50 # 1 if daemon was already running |
|
51 # other if daemon could not be started or a failure occured |
|
52 start-stop-daemon --start --chuid brewery --exec $DAEMON |
49 } |
53 } |
50 |
54 |
51 # |
55 # |
52 # Function that stops the daemon/service |
56 # Function that stops the daemon/service |
53 # |
57 # |
54 do_stop() |
58 do_stop() |
55 { |
59 { |
56 [ -f $PIDFILE ] && kill $(cat $PIDFILE) |
60 # Return |
57 RETVAL="$?" |
61 # 0 if daemon has been stopped |
58 return "$RETVAL" |
62 # 1 if daemon was already stopped |
|
63 # other if daemon could not be stopped or a failure occurred |
|
64 start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE --exec $DAEMON |
59 } |
65 } |
60 |
66 |
61 # |
67 # |
62 # Function that sends a SIGHUP to the daemon/service |
68 # Function that sends a SIGHUP to the daemon/service |
63 # |
69 # |