summaryrefslogtreecommitdiff
path: root/addons/x11phonehome/etc/init.d/local-phonehome
blob: 4b8ebfa49f9fd0d24cae7f2aae6de7af159d6d42 (plain)
  1. #! /bin/sh
  2. #
  3. # local-phonehome
  4. #
  5. # Author: Jonas Smedegaard <dr@jones.dk>
  6. #
  7. set -e
  8. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  9. DESC="PhoneHome daemons"
  10. NAME=phonehome
  11. DAEMON=/usr/sbin/$NAME
  12. PIDFILE=/var/run/$NAME.pid
  13. SCRIPTNAME=/etc/init.d/$NAME
  14. # Gracefully exit if the package has been removed.
  15. #test -x $DAEMON || exit 0
  16. # Read config file if it is present.
  17. #if [ -r /etc/default/$NAME ]
  18. #then
  19. # . /etc/default/$NAME
  20. #fi
  21. #
  22. # Function that starts the daemon/service.
  23. #
  24. d_start() {
  25. # start-stop-daemon --start --quiet --pidfile $PIDFILE \
  26. # --exec $DAEMON
  27. killall Xorg -wq || /bin/true
  28. /usr/local/bin/launch-x11
  29. sleep 5
  30. /usr/local/bin/launch-unclutter
  31. /usr/bin/motion
  32. }
  33. #
  34. # Function that stops the daemon/service.
  35. #
  36. d_stop() {
  37. # start-stop-daemon --stop --quiet --pidfile $PIDFILE \
  38. # --name $NAME
  39. /usr/bin/killall TERM motion || /bin/true
  40. /usr/local/bin/launch-unclutter -k || /bin/true
  41. /usr/local/bin/launch-x11 -k || /bin/true
  42. killall Xorg -wq || /bin/true
  43. }
  44. #
  45. # Function that sends a SIGHUP to the daemon/service.
  46. #
  47. #d_reload() {
  48. # start-stop-daemon --stop --quiet --pidfile $PIDFILE \
  49. # --name $NAME --signal 1
  50. #}
  51. case "$1" in
  52. start)
  53. echo -n "Starting $DESC: $NAME"
  54. d_start
  55. echo "."
  56. ;;
  57. stop)
  58. echo -n "Stopping $DESC: $NAME"
  59. d_stop
  60. echo "."
  61. ;;
  62. #reload)
  63. #
  64. # If the daemon can reload its configuration without
  65. # restarting (for example, when it is sent a SIGHUP),
  66. # then implement that here.
  67. #
  68. # If the daemon responds to changes in its config file
  69. # directly anyway, make this an "exit 0".
  70. #
  71. # echo -n "Reloading $DESC configuration..."
  72. # d_reload
  73. # echo "done."
  74. #;;
  75. restart|force-reload)
  76. #
  77. # If the "reload" option is implemented, move the "force-reload"
  78. # option to the "reload" entry above. If not, "force-reload" is
  79. # just the same as "restart".
  80. #
  81. echo -n "Restarting $DESC: $NAME"
  82. d_stop
  83. sleep 1
  84. d_start
  85. echo "."
  86. ;;
  87. *)
  88. # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  89. echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  90. exit 1
  91. ;;
  92. esac
  93. exit 0