init.d.ex 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #! /bin/sh
  2. #
  3. # skeleton example file to build /etc/init.d/ scripts.
  4. # This file should be used to construct scripts for /etc/init.d.
  5. #
  6. # Written by Miquel van Smoorenburg <miquels@cistron.nl>.
  7. # Modified for Debian
  8. # by Ian Murdock <imurdock@gnu.ai.mit.edu>.
  9. #
  10. # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
  11. #
  12. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  13. DAEMON=/usr/sbin/@hybridapp@
  14. NAME=@hybridapp@
  15. DESC=@hybridapp@
  16. test -x $DAEMON || exit 0
  17. # Include @hybridapp@ defaults if available
  18. if [ -f /etc/default/@hybridapp@ ] ; then
  19. . /etc/default/@hybridapp@
  20. fi
  21. set -e
  22. case "$1" in
  23. start)
  24. echo -n "Starting $DESC: "
  25. start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
  26. --exec $DAEMON -- $DAEMON_OPTS
  27. echo "$NAME."
  28. ;;
  29. stop)
  30. echo -n "Stopping $DESC: "
  31. start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
  32. --exec $DAEMON
  33. echo "$NAME."
  34. ;;
  35. #reload)
  36. #
  37. # If the daemon can reload its config files on the fly
  38. # for example by sending it SIGHUP, do it here.
  39. #
  40. # If the daemon responds to changes in its config file
  41. # directly anyway, make this a do-nothing entry.
  42. #
  43. # echo "Reloading $DESC configuration files."
  44. # start-stop-daemon --stop --signal 1 --quiet --pidfile \
  45. # /var/run/$NAME.pid --exec $DAEMON
  46. #;;
  47. force-reload)
  48. #
  49. # If the "reload" option is implemented, move the "force-reload"
  50. # option to the "reload" entry above. If not, "force-reload" is
  51. # just the same as "restart" except that it does nothing if the
  52. # daemon isn't already running.
  53. # check wether $DAEMON is running. If so, restart
  54. start-stop-daemon --stop --test --quiet --pidfile \
  55. /var/run/$NAME.pid --exec $DAEMON \
  56. && $0 restart \
  57. || exit 0
  58. ;;
  59. restart)
  60. echo -n "Restarting $DESC: "
  61. start-stop-daemon --stop --quiet --pidfile \
  62. /var/run/$NAME.pid --exec $DAEMON
  63. sleep 1
  64. start-stop-daemon --start --quiet --pidfile \
  65. /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
  66. echo "$NAME."
  67. ;;
  68. *)
  69. N=/etc/init.d/$NAME
  70. # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  71. echo "Usage: $N {start|stop|restart|force-reload}" >&2
  72. exit 1
  73. ;;
  74. esac
  75. exit 0