1#! /bin/sh 2# 3# Author: Jaakko Niemi <liiwi@iki.fi> 4# Modified from skeleton file in sarge 5 6### BEGIN INIT INFO 7# Provides: tftp-hpa 8# Required-Start: $local_fs $remote_fs $syslog $network 9# Required-Stop: $local_fs $remote_fs $syslog $network 10# Default-Start: 2 3 4 5 11# Default-Stop: 1 12# Short-Description: HPA's tftp client 13# Description: tftp server to allow booting clients which support 14# the PXE protocol. 15### END INIT INFO 16 17set -e 18 19PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 20DESC="HPA's tftpd" 21NAME=in.tftpd-hpa 22SCRIPTNAME=/etc/init.d/tftpd-hpa 23 24# Read config file if it is present. 25if [ -r /etc/default/tftpd-hpa ] 26then 27 . /etc/default/tftpd-hpa 28fi 29 30DAEMON=/usr/sbin/$NAME 31PIDFILE=/var/run/$NAME.pid 32 33# Gracefully exit if the package has been removed. 34test -x $DAEMON || exit 0 35 36if [ "$RUN_DAEMON" != "yes" ] ; then 37 echo "tftpd-hpa disabled in /etc/default/tftpd-hpa" 38 exit 0 39fi 40 41# 42# Function that starts the daemon/service. 43# 44d_start() { 45 start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS 46} 47 48# 49# Function that stops the daemon/service. 50# 51d_stop() { 52 start-stop-daemon --stop --quiet --name $NAME 53} 54 55# 56# Function that sends a SIGHUP to the daemon/service. 57# 58d_reload() { 59 start-stop-daemon --stop --quiet --name $NAME --signal 1 60} 61 62case "$1" in 63 start) 64 echo "Starting $DESC: $NAME" 65 d_start 66 echo "." 67 ;; 68 stop) 69 echo "Stopping $DESC: $NAME" 70 d_stop 71 echo "." 72 ;; 73 #reload) 74 # 75 # If the daemon can reload its configuration without 76 # restarting (for example, when it is sent a SIGHUP), 77 # then implement that here. 78 # 79 # If the daemon responds to changes in its config file 80 # directly anyway, make this an "exit 0". 81 # 82 # echo -n "Reloading $DESC configuration..." 83 # d_reload 84 # echo "done." 85 #;; 86 restart|force-reload) 87 # 88 # If the "reload" option is implemented, move the "force-reload" 89 # option to the "reload" entry above. If not, "force-reload" is 90 # just the same as "restart". 91 # 92 echo "Restarting $DESC: $NAME" 93 d_stop 94 sleep 1 95 d_start 96 echo "." 97 ;; 98 *) 99 # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 100 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 101 exit 1 102 ;; 103esac 104 105exit 0 106