S50polkitd 953 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. DAEMON="polkitd"
  3. DAEMON_PATH="/usr/lib/polkit-1/${DAEMON}"
  4. PIDFILE="/var/run/${DAEMON}.pid"
  5. POLKITD_ARGS="--no-debug"
  6. # polkitd does not create a pidfile, so pass "-n" in the command line
  7. # and use "-m" to instruct start-stop-daemon to create one.
  8. start() {
  9. printf 'Starting %s: ' "${DAEMON}"
  10. # shellcheck disable=SC2086 # we need the word splitting
  11. start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${POLKITD_ARGS}
  12. status=$?
  13. if [ "$status" -eq 0 ]; then
  14. echo "OK"
  15. else
  16. echo "FAIL"
  17. fi
  18. return "$status"
  19. }
  20. stop() {
  21. printf 'Stopping %s: ' "${DAEMON}"
  22. start-stop-daemon -Kqp "$PIDFILE"
  23. status=$?
  24. if [ "$status" -eq 0 ]; then
  25. rm -f "$PIDFILE"
  26. echo "OK"
  27. else
  28. echo "FAIL"
  29. fi
  30. return "$status"
  31. }
  32. restart() {
  33. stop
  34. sleep 1
  35. start
  36. }
  37. case "$1" in
  38. start|stop|restart)
  39. "$1";;
  40. reload)
  41. # Restart, since there is no true "reload" feature.
  42. restart;;
  43. *)
  44. echo "Usage: $0 {start|stop|restart|reload}"
  45. exit 1
  46. esac