init-tftpd 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #! /bin/sh
  2. #
  3. # Author: Jaakko Niemi <liiwi@iki.fi>
  4. # Modified from skeleton file in sarge
  5. #Defaults for tftpd-hpa
  6. RUN_DAEMON="yes"
  7. OPTIONS="-l -s /var/lib/tftpboot"
  8. set -e
  9. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  10. DESC="HPA's tftpd"
  11. NAME=in.tftpd
  12. DAEMON=/usr/sbin/$NAME
  13. PIDFILE=/var/run/$NAME.pid
  14. SCRIPTNAME=/etc/init.d/S80tftpd-hpa
  15. # Gracefully exit if the package has been removed.
  16. test -x $DAEMON || exit 0
  17. if [ "$RUN_DAEMON" != "yes" ] ; then
  18. echo "tftpd-hpa disabled in /etc/init.d/S80tftpd-hpa"
  19. exit 0
  20. fi
  21. #
  22. # Function that starts the daemon/service.
  23. #
  24. d_start() {
  25. start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS
  26. }
  27. #
  28. # Function that stops the daemon/service.
  29. #
  30. d_stop() {
  31. start-stop-daemon --stop --quiet --name $NAME
  32. }
  33. #
  34. # Function that sends a SIGHUP to the daemon/service.
  35. #
  36. d_reload() {
  37. start-stop-daemon --stop --quiet --name $NAME --signal 1
  38. }
  39. case "$1" in
  40. start)
  41. echo -n "Starting $DESC: $NAME"
  42. d_start
  43. echo "."
  44. ;;
  45. stop)
  46. echo -n "Stopping $DESC: $NAME"
  47. d_stop
  48. echo "."
  49. ;;
  50. #reload)
  51. #
  52. # If the daemon can reload its configuration without
  53. # restarting (for example, when it is sent a SIGHUP),
  54. # then implement that here.
  55. #
  56. # If the daemon responds to changes in its config file
  57. # directly anyway, make this an "exit 0".
  58. #
  59. # echo -n "Reloading $DESC configuration..."
  60. # d_reload
  61. # echo "done."
  62. #;;
  63. restart|force-reload)
  64. #
  65. # If the "reload" option is implemented, move the "force-reload"
  66. # option to the "reload" entry above. If not, "force-reload" is
  67. # just the same as "restart".
  68. #
  69. echo -n "Restarting $DESC: $NAME"
  70. d_stop
  71. sleep 1
  72. d_start
  73. echo "."
  74. ;;
  75. *)
  76. # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  77. echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  78. exit 1
  79. ;;
  80. esac
  81. exit 0