S80swupdate 787 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. DAEMON="swupdate"
  3. DAEMON_WRAPPER="/usr/lib/swupdate/swupdate.sh"
  4. PIDFILE="/var/run/$DAEMON.pid"
  5. start() {
  6. printf 'Starting %s: ' "$DAEMON"
  7. start-stop-daemon -S -q -b -m -p "$PIDFILE" -x $DAEMON_WRAPPER
  8. status=$?
  9. if [ "$status" -eq 0 ]; then
  10. echo "OK"
  11. else
  12. echo "FAIL"
  13. fi
  14. return "$status"
  15. }
  16. stop() {
  17. printf 'Stopping %s: ' "$DAEMON"
  18. start-stop-daemon -K -q -p "$PIDFILE"
  19. status=$?
  20. if [ "$status" -eq 0 ]; then
  21. echo "OK"
  22. else
  23. echo "FAIL"
  24. fi
  25. return "$status"
  26. }
  27. restart() {
  28. stop
  29. sleep 1
  30. start
  31. }
  32. case "$1" in
  33. start|stop|restart)
  34. "$1";;
  35. reload)
  36. # Restart, since there is no true "reload" feature (does not
  37. # reconfigure/restart on SIGHUP, just closes all open files).
  38. restart;;
  39. *)
  40. echo "Usage: $0 {start|stop|restart|reload}"
  41. exit 1
  42. esac