VSFTP 设为服务的脚本
#!/bin/bash# chkconfig: - 60 50#description:vsftpd#conf:/etc/vsftpd/vsftp.conf#cp vsftpd/etc/init.d/vsftpd#chmod 755 /etc/init.d/vsftpd#chkconfig --add vsftpd #chkconfig vsftpd onif [ -f /etc/init.d/functions ] then. /etc/init.d/functionselif [ -f /etc/rc.d/init.d/functions ]then. /etc/rc.d/init.d/functionselseexit 0fivsftpd=/usr/local/sbin/vsftpd ftpconf=/etc/vsftpd.confprog=vsftpdRETVAL=0start() { if [ -n "`/sbin/pidof $prog`" ] then echo "$prog: already running" return 1 fi echo "Starting $prog:" base=$prog $vsftpd $ftpconf& if [ -z "`/sbin/pidof $prog`" ] then RETVAL=1 fi if [ $RETVAL -ne 0 ] then echo "Startup failure" else echo "Startup success" fi return $RETVAL} stop() {if [ -z "`/sbin/pidof $prog`" ]thenRETVAL=1fiif [ $RETVAL -ne 0 ]thenecho "vsftpd no have run"else echo "Stopping $prog:" killall $vsftpd RETVAL=$? if [ $RETVAL -ne 0 ] then echo "Shutdown failure" else echo "Shutdown success" fifi} case "$1" instart) start ;;stop) stop ;;status) status $vsftpd RETVAL=$? ;;restart) stop start ;;*) echo "Usage: $prog {start|stop|restart|status}" exit 1esacexit $RETVAL
页:
[1]