summaryrefslogtreecommitdiff
path: root/addons/x11phonehome/etc/init.d/local-phonehome
blob: 5c3c9c331b7e92e9a3fffcf27ec234b160722e2e (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. # Dirty hack to overload newer PWC driver
  32. insmod $(find /lib/modules/ -name videodev.ko) || true
  33. insmod $(find /lib/modules/ -regex '.*/media/pwc\.ko') || true
  34. # /usr/bin/motion
  35. /usr/local/bin/launch-simpleopal
  36. }
  37. #
  38. # Function that stops the daemon/service.
  39. #
  40. d_stop() {
  41. # start-stop-daemon --stop --quiet --pidfile $PIDFILE \
  42. # --name $NAME
  43. /usr/local/bin/launch-simpleopal -k || /bin/true
  44. # /usr/bin/killall TERM motion || /bin/true
  45. /usr/local/bin/launch-unclutter -k || /bin/true
  46. /usr/local/bin/launch-x11 -k || /bin/true
  47. killall Xorg -wq || /bin/true
  48. }
  49. #
  50. # Function that sends a SIGHUP to the daemon/service.
  51. #
  52. #d_reload() {
  53. # start-stop-daemon --stop --quiet --pidfile $PIDFILE \
  54. # --name $NAME --signal 1
  55. #}
  56. case "$1" in
  57. start)
  58. echo -n "Starting $DESC: $NAME"
  59. d_start
  60. echo "."
  61. ;;
  62. stop)
  63. echo -n "Stopping $DESC: $NAME"
  64. d_stop
  65. echo "."
  66. ;;
  67. #reload)
  68. #
  69. # If the daemon can reload its configuration without
  70. # restarting (for example, when it is sent a SIGHUP),
  71. # then implement that here.
  72. #
  73. # If the daemon responds to changes in its config file
  74. # directly anyway, make this an "exit 0".
  75. #
  76. # echo -n "Reloading $DESC configuration..."
  77. # d_reload
  78. # echo "done."
  79. #;;
  80. restart|force-reload)
  81. #
  82. # If the "reload" option is implemented, move the "force-reload"
  83. # option to the "reload" entry above. If not, "force-reload" is
  84. # just the same as "restart".
  85. #
  86. echo -n "Restarting $DESC: $NAME"
  87. d_stop
  88. sleep 1
  89. d_start
  90. echo "."
  91. ;;
  92. *)
  93. # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  94. echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  95. exit 1
  96. ;;
  97. esac
  98. exit 0