S80tftpd-hpa 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #! /bin/sh
  2. OPTIONS="-c -l -s /var/lib/tftpboot"
  3. set -e
  4. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  5. DESC="HPA's tftpd"
  6. NAME=tftpd
  7. DAEMON=/usr/sbin/$NAME
  8. PIDFILE=/var/run/$NAME.pid
  9. SCRIPTNAME=/etc/init.d/S80tftpd-hpa
  10. #
  11. # Function that starts the daemon/service.
  12. #
  13. d_start() {
  14. mkdir -p /var/lib/tftpboot
  15. chmod 1777 /var/lib/tftpboot
  16. $DAEMON $OPTIONS
  17. }
  18. #
  19. # Function that stops the daemon/service.
  20. #
  21. d_stop() {
  22. killall -q $NAME
  23. }
  24. #
  25. # Function that sends a SIGHUP to the daemon/service.
  26. #
  27. d_reload() {
  28. d_start
  29. d_stop
  30. }
  31. case "$1" in
  32. start)
  33. printf "Starting $DESC: "
  34. d_start
  35. echo "done"
  36. ;;
  37. stop)
  38. printf "Stopping $DESC: "
  39. d_stop
  40. echo "done"
  41. ;;
  42. #reload)
  43. #
  44. # If the daemon can reload its configuration without
  45. # restarting (for example, when it is sent a SIGHUP),
  46. # then implement that here.
  47. #
  48. # If the daemon responds to changes in its config file
  49. # directly anyway, make this an "exit 0".
  50. #
  51. # printf "Reloading $DESC configuration..."
  52. # d_reload
  53. # echo "done."
  54. #;;
  55. restart|force-reload)
  56. #
  57. # If the "reload" option is implemented, move the "force-reload"
  58. # option to the "reload" entry above. If not, "force-reload" is
  59. # just the same as "restart".
  60. #
  61. printf "Restarting $DESC: "
  62. d_stop
  63. sleep 1
  64. d_start
  65. echo "done"
  66. ;;
  67. *)
  68. # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  69. echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  70. exit 1
  71. ;;
  72. esac
  73. exit 0