S80tftpd-hpa 1.4 KB

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