]>
git.zerfleddert.de Git - hmcfgusb/blob - debian/hmland.init
a2bf4b6c6e39bc59ae903d3bf69e00cbd5a6fe90
4 # Required-Start: $network $local_fs $remote_fs
5 # Required-Stop: $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: <Enter a short description of the sortware>
9 # Description: <Enter a long description of the software>
14 # Author: root <jsurf@gmx.de>
16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
17 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
18 DESC
="Homematic LAN Adapter service" # Introduce a short description here
19 NAME
=hmland
# Introduce the short server's name here
20 DAEMON
=/opt
/hm
/hmcfgusb
/$NAME # Introduce the server's location here
21 DAEMON_ARGS
="-d -P" # Arguments to run the daemon with
22 PIDFILE
=/var
/run
/$NAME.pid
23 SCRIPTNAME
=/etc
/init.d
/$NAME
25 if [ ! -x $DAEMON ]; then
26 DAEMON
=/opt
/hmcfgusb
/$NAME #location from Fhem wiki...
29 # Exit if the package is not installed
30 [ -x $DAEMON ] ||
exit 0
36 # Read configuration variable file if it is present
37 [ -r /etc
/default
/$NAME ] && .
/etc
/default
/$NAME
39 test "$HMLAND_ENABLED" != "0" ||
exit 0
41 DAEMON_ARGS
="$DAEMON_ARGS -p $HMLAND_PORT $HMLAND_OPTS"
43 if [ "$HMLAND_LOGGING" = "yes" ]; then
44 DAEMON_ARGS
="$DAEMON_ARGS -L /var/log/hmland.log"
47 # Load the VERBOSE setting and other rcS variables
50 # Define LSB log_* functions.
51 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
52 .
/lib
/lsb
/init-functions
55 # Function that starts the daemon/service
60 # 0 if daemon has been started
61 # 1 if daemon was already running
62 # 2 if daemon could not be started
63 start-stop-daemon
--start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev
/null \
65 start-stop-daemon
--start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
68 # Add code here, if necessary, that waits for the process to be ready
69 # to handle requests from services started subsequently which depend
70 # on this one. As a last resort, sleep for some time.
74 # Function that stops the daemon/service
79 # 0 if daemon has been stopped
80 # 1 if daemon was already stopped
81 # 2 if daemon could not be stopped
82 # other if a failure occurred
83 start-stop-daemon
--stop --quiet --retry=TERM
/30/KILL
/5 --pidfile $PIDFILE --name $NAME
85 [ "$RETVAL" = 2 ] && return 2
86 # Wait for children to finish too if this is a daemon that forks
87 # and if the daemon is only ever run from this initscript.
88 # If the above conditions are not satisfied then add some other code
89 # that waits for the process to drop all resources that could be
90 # needed by services started subsequently. A last resort is to
91 # sleep for some time.
92 start-stop-daemon
--stop --quiet --oknodo --retry=0/30/KILL
/5 --exec $DAEMON
93 [ "$?" = 2 ] && return 2
94 # Many daemons don't delete their pidfiles when they exit.
100 # Function that sends a SIGHUP to the daemon/service
104 # If the daemon can reload its configuration without
105 # restarting (for example, when it is sent a SIGHUP),
106 # then implement that here.
108 start-stop-daemon
--stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
114 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC " "$NAME"
117 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
118 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
122 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
125 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
126 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
130 status_of_proc
"$DAEMON" "$NAME" && exit 0 ||
exit $?
132 #reload|force-reload)
134 # If do_reload() is not implemented then leave this commented out
135 # and leave 'force-reload' as an alias for 'restart'.
137 #log_daemon_msg "Reloading $DESC" "$NAME"
141 restart|force-reload
)
143 # If the "reload" option is implemented then remove the
144 # 'force-reload' alias
146 log_daemon_msg
"Restarting $DESC" "$NAME"
153 1) log_end_msg
1 ;; # Old process is still running
154 *) log_end_msg
1 ;; # Failed to start
164 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
165 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2