S99domoticz 822 B

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