1#!/bin/sh 2 3DAEMON="domoticz" 4PIDFILE="/var/run/$DAEMON.pid" 5 6DOMOTICZ_ARGS="-daemon -www 8080 -sslwww 443" 7 8[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" 9 10start() { 11 printf 'Starting %s: ' "$DAEMON" 12 start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/opt/domoticz/$DAEMON" \ 13 -- $DOMOTICZ_ARGS 14 status=$? 15 if [ "$status" -eq 0 ]; then 16 echo "OK" 17 else 18 echo "FAIL" 19 fi 20 return "$status" 21} 22 23stop() { 24 printf 'Stopping %s: ' "$DAEMON" 25 start-stop-daemon -K -q -p "$PIDFILE" 26 status=$? 27 if [ "$status" -eq 0 ]; then 28 rm -f "$PIDFILE" 29 echo "OK" 30 else 31 echo "FAIL" 32 fi 33 return "$status" 34} 35 36restart() { 37 stop 38 sleep 1 39 start 40} 41 42case "$1" in 43 start|stop|restart) 44 "$1";; 45 reload) 46 # Restart, since there is no true "reload" feature. 47 restart;; 48 *) 49 echo "Usage: $0 {start|stop|restart|reload}" 50 exit 1 51esac 52