S81cupsd 800 B

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