You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

89 lines
2.4 KiB

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: elogind
  4. # Required-Start: dbus $remote_fs $syslog
  5. # Required-Stop: dbus $remote_fs $syslog
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: start elogind at boot tim
  9. # Description: Enable user and session management by elogind
  10. ### END INIT INFO
  11. set -e
  12. # /etc/init.d/elogind: start and stop the elogind session management daemon
  13. ELOGIND=/usr/sbin/elogind
  14. test -x $ELOGIND || exit 0
  15. umask 022
  16. . /lib/lsb/init-functions
  17. ELOGIND_OPTS="-D"
  18. ELOGIND_PID=/run/elogind.pid
  19. export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
  20. case "$1" in
  21. start)
  22. log_daemon_msg "Starting session management daemon" "elogind" || true
  23. if start-stop-daemon --start --quiet --oknodo --pidfile $ELOGIND_PID --exec $ELOGIND -- $ELOGIND_OPTS; then
  24. log_end_msg 0 || true
  25. else
  26. log_end_msg 1 || true
  27. fi
  28. ;;
  29. stop)
  30. log_daemon_msg "Stopping session management daemon" "elogind" || true
  31. if start-stop-daemon --stop --quiet --oknodo --pidfile $ELOGIND_PID; then
  32. log_end_msg 0 || true
  33. else
  34. log_end_msg 1 || true
  35. fi
  36. ;;
  37. reload|force-reload|restart)
  38. log_daemon_msg "Restarting session management daemon" "elogind" || true
  39. start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $ELOGIND_PID
  40. if start-stop-daemon --start --quiet --oknodo --pidfile $ELOGIND_PID --exec $ELOGIND -- $ELOGIND_OPTS; then
  41. log_end_msg 0 || true
  42. else
  43. log_end_msg 1 || true
  44. fi
  45. ;;
  46. try-restart)
  47. log_daemon_msg "Restarting session management daemon" "elogind" || true
  48. RET=0
  49. start-stop-daemon --stop --quiet --retry 30 --pidfile $ELOGIND_PID || RET="$?"
  50. case $RET in
  51. 0)
  52. # old daemon stopped
  53. if start-stop-daemon --start --quiet --oknodo --pidfile $ELOGIND_PID --exec $ELOGIND -- $ELOGIND_OPTS; then
  54. log_end_msg 0 || true
  55. else
  56. log_end_msg 1 || true
  57. fi
  58. ;;
  59. 1)
  60. # daemon not running
  61. log_progress_msg "(not running)" || true
  62. log_end_msg 0 || true
  63. ;;
  64. *)
  65. # failed to stop
  66. log_progress_msg "(failed to stop)" || true
  67. log_end_msg 1 || true
  68. ;;
  69. esac
  70. ;;
  71. status)
  72. status_of_proc -p $ELOGIND_PID $ELOGIND elogind && exit 0 || exit $?
  73. ;;
  74. *)
  75. log_action_msg "Usage: /etc/init.d/elogind {start|stop|reload|force-reload|restart|try-restart|status}" || true
  76. exit 1
  77. esac
  78. exit 0