2008-01-17 17:04:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# chkconfig: 345 85 60
|
|
|
|
# description: TFTP server
|
|
|
|
# processname: atftpd
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: tftpd
|
2009-04-08 22:40:21 +00:00
|
|
|
# Required-Start:
|
|
|
|
# Required-Stop:
|
2008-01-17 17:04:38 +00:00
|
|
|
# Default-Start: 3 4 5
|
|
|
|
# Default-stop: 0 1 2 6
|
|
|
|
# Short-Description: atftp
|
|
|
|
# Description: ATFTP server
|
|
|
|
### END INIT INFO
|
|
|
|
|
2008-10-13 19:42:58 +00:00
|
|
|
if [ -r /etc/sysconfig/atftpd ]; then
|
|
|
|
. /etc/sysconfig/atftpd
|
|
|
|
fi
|
2008-01-17 17:04:38 +00:00
|
|
|
|
2008-06-26 13:52:36 +00:00
|
|
|
RHSuccess()
|
|
|
|
{
|
|
|
|
success
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
RHFailure()
|
|
|
|
{
|
|
|
|
failure
|
|
|
|
echo
|
|
|
|
}
|
2008-01-17 17:04:38 +00:00
|
|
|
MStatus()
|
|
|
|
{
|
2008-03-24 17:04:06 +00:00
|
|
|
ps ax|grep -v grep|grep atftpd >& /dev/null
|
2008-01-17 17:04:38 +00:00
|
|
|
if [ "$?" = "0" ]; then
|
|
|
|
RVAL=0
|
|
|
|
echo "atftpd service is running"
|
|
|
|
else
|
|
|
|
RVAL=3
|
|
|
|
echo "atftpd service is not running"
|
|
|
|
fi
|
|
|
|
return $RVAL
|
|
|
|
}
|
|
|
|
|
2008-06-26 13:52:36 +00:00
|
|
|
if [ -f /etc/init.d/functions ]; then
|
|
|
|
. /etc/init.d/functions
|
|
|
|
START_DAEMON=daemon
|
|
|
|
STATUS=MStatus
|
|
|
|
LOG_SUCCESS=RHSuccess
|
|
|
|
LOG_FAILURE=RHFailure
|
|
|
|
LOG_WARNING=passed
|
|
|
|
elif [ -f /lib/lsb/init-functions ]; then
|
2008-01-17 17:04:38 +00:00
|
|
|
. /lib/lsb/init-functions
|
|
|
|
START_DAEMON=start_daemon
|
|
|
|
STATUS=MStatus
|
|
|
|
LOG_SUCCESS=log_success_msg
|
|
|
|
LOG_FAILURE=log_failure_msg
|
|
|
|
LOG_WARNING=log_warning_message
|
|
|
|
else
|
|
|
|
echo "Error, don't know how to start on this platform"
|
|
|
|
exit 1
|
|
|
|
fi
|
2008-10-13 19:42:58 +00:00
|
|
|
MULTARG="--no-multicast"
|
2008-01-17 17:04:38 +00:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
$STATUS
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "Stopping ATFTP "
|
2008-06-26 13:52:36 +00:00
|
|
|
if killproc atftpd; then
|
|
|
|
$LOG_SUCCESS
|
|
|
|
else
|
|
|
|
$LOG_FAILURE
|
|
|
|
fi
|
2008-01-17 17:04:38 +00:00
|
|
|
;;
|
|
|
|
start)
|
|
|
|
echo -n "Starting ATFTP "
|
2008-10-13 19:42:58 +00:00
|
|
|
if [ "$ATFTPMULTICAST" == "yes" ]; then
|
|
|
|
MULTARG=""
|
|
|
|
fi
|
|
|
|
$START_DAEMON /usr/sbin/atftpd $MULTARG --group nobody --daemon && $LOG_SUCCESS || $LOG_FAILURE
|
2008-01-17 17:04:38 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|