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