⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rc.tftpserver

📁 一个简单的tftp服务器
💻 TFTPSERVER
字号:
#!/bin/bash#Start/stop tftpserver#Originally Contributed by sharne, slightly modified.################################################################################################################################################################################################################ This file daemonizes the tftpserver to start automatically when system starts#### Please do the following (todo)####  1) Add the following lines to /etc/rc.d/rc.inet2, at the end. Alternatively You can also add##     these lines to rc.local or inittab files.####	# Start the tftpserver daemon:##	if [ -x /etc/rc.d/rc.tftpserver ]; then##	  /etc/rc.d/rc.tftpserver start##	fi####  2) Modify the tftpserver_start() function in line 29 below, setting the file locations.####  3) Change the permissions of this file rc.tftpserver to 755 after installing it in /etc/rc.d################################################################################################################################################################################################################pidnum=$( ps -eaf | grep -v grep | grep -v rc.tftpserver | grep tftpserver | awk '{ printf("%s %s\n",$3,$2) }' | sort | head -1 | awk '{ print $2 }' )# Start tftpserver:tftpserver_start() {##### Modify line below for location of executive and other files #####/opt/tftpserversp/tftpserver -i /opt/tftpserversp/tftpserver.ini -l /opt/tftpserversp/tftpserver.logecho "Server tftpserver started"}# Stop tftpserver:tftpserver_stop() {kill -9 $pidnum  while [ true ]dopidnum=$( ps -eaf | grep -v grep | grep -v rc.tftpserver | grep tftpserver | awk '{ print $2 }' | head -1 )if [ -z "$pidnum" ]thenbreakfidoneecho "Server tftpserver stopped"}case "$1" in'start')if [ -z "$pidnum" ]thentftpserver_startRETVAL=0elseecho "Server is already running - Try restart"RETVAL=1fi;;'stop')if [ -z "$pidnum" ]thenecho "Server is not running"RETVAL=1elsetftpserver_stopRETVAL=0fi;;'restart')if [ -z "$pidnum" ]thenecho "Server is not running"tftpserver_startelsetftpserver_stoptftpserver_startfiRETVAL=0;;'status')if [ -z "$pidnum" ]thenecho "Server is not running"RETVAL=1elseecho "Server is running - Pid : $pidnum"RETVAL=0fi;;*)echo "Usage $0 { start | stop | restart | status }"RETVAL=1;;esacexit $RETVAL# Enjoy!

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -