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