2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-24 18:40:05 +00:00
xcat-dep/atftp/tftpd
2008-03-24 17:04:06 +00:00

68 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# chkconfig: 345 85 60
# description: TFTP server
# processname: atftpd
### BEGIN INIT INFO
# Provides: tftpd
# Default-Start: 3 4 5
# Default-stop: 0 1 2 6
# Short-Description: atftp
# Description: ATFTP server
### END INIT INFO
MStatus()
{
ps ax|grep -v grep|grep atftpd >& /dev/null
if [ "$?" = "0" ]; then
RVAL=0
echo "atftpd service is running"
else
RVAL=3
echo "atftpd service is not running"
fi
return $RVAL
}
if [ -f /lib/lsb/init-functions ]; then
. /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
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
START_DAEMON=daemon
STATUS=MStatus
LOG_SUCCESS=success
LOG_FAILURE=failure
LOG_WARNING=passed
else
echo "Error, don't know how to start on this platform"
exit 1
fi
case $1 in
restart)
$0 stop
$0 start
;;
status)
$STATUS
;;
stop)
echo -n "Stopping ATFTP "
killproc atftpd
;;
start)
echo -n "Starting ATFTP "
$START_DAEMON atftpd --group nobody --daemon && $LOG_SUCCESS || $LOG_FAILURE
;;
esac