The Linux boot service is to use service + TFTPD, the (Ubuntu) service will go to find/ETC/INIT.D under the launch program, service +TFTPD can run.
Chkconfig is used to add the service to the boot list.
Chkconfig--add tftpd
chkconfig--list chkconfig tftpd on/off
Writing shell Scripts
#!/bin/bash #description: tftpd #chkconfig: 2345-Bayi set-e #及时返回错误 exec_path=/software/tftp-1.0/exec=tftpd daemon=/sof TWARE/TFTP-1.0/TFTPD Pid_file=/var/run/tftpd.pid #. /etc/rc.d/init.d/functions IF [!-X $EXEC _path/$EXEC];
Then echo "ERROR: $DAEMON not found" Exit 1 fi Stop () {echo "stoping $EXEC ..." PS aux | grep "$DAEMON" | Kill-9 ' awk ' {print $} ' >/dev/null 2>&1 # 0 input 1 Output 2 error output/dev/null empty device file & representation equivalent to, background execution rm-f $PID _file # usleep echo "shutting down $EXEC: [OK]" status} status () {pid= ' ps aux | g Rep "$DAEMON" |grep-v grep | awk ' {print $} ' # grep-v grep is the elimination of inclusion grep, that is, itself, the last process. The reverse single quotation mark executes the command and assigns a value #echo $PID if (("$PID")); Then #判断 $PID is true, TFTPD starts echo "TFTPD start/running, Process $PID" Else echo "tftpd stop/waiting" fi} start ( {echo "Starting $EXEC ..." $DAEMON >/dev/null & pidof $EXEC > $PID _fILE # usleep echo "Starting $EXEC: [OK]" status} restart () {stop
Start} case "in Start" start;;
stop) stop;;
restart) restart;;
Status) # Status-p $PID _file $DAEMON Status *) echo "Usage:service $EXEC {start|stop|restart|status}" Exit 1 Esac exit $?
Registration Service
chmod tftpd
CP./TFTPD/ETC/INIT.D
chkconfig--add tftpd chkconfig
--list
Delete Service
Chkconfig--del TFTPD
Chkconfig--del TFTPD
In addition: Process directory/proc/process ID;