updated on Tue Jan 17 20:03:13 UTC 2012
[aur-mirror.git] / atftp / atftpd.rc
blobb7060724b83568bd3f55fec9476ac756cafa66ca
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 [ -f /etc/conf.d/atftpd ] && . /etc/conf.d/atftpd
8 PIDFILE=/var/run/atftpd.pid
9 PID=$(cat $PIDFILE 2>/dev/null)
10 if ! readlink -q /proc/$PID/exe | grep -q '^/usr/sbin/atftpd'; then
11 PID=
12 rm $PIDFILE 2>/dev/null
15 case "$1" in
16 start)
17 stat_busy "Starting Advanced TFTP Daemon"
18 [ -z "$PID" ] && /usr/sbin/atftpd --daemon --pidfile ${PIDFILE} ${ATFTPD_ARGS}
19 if [ $? -gt 0 ]; then
20 stat_fail
21 else
22 add_daemon atftpd
23 stat_done
26 stop)
27 stat_busy "Stopping Advanced TFTP Daemon"
28 [ ! -z "$PID" ] && kill $PID &> /dev/null
29 if [ $? -gt 0 ]; then
30 stat_fail
31 else
32 rm_daemon atftpd
33 stat_done
36 restart)
37 $0 stop
38 sleep 1
39 $0 start
42 echo "usage: $0 {start|stop|restart}"
43 esac
44 exit 0