- 论坛徽章:
- 0
|
我安装了vsftpd(源代码安装),但没有找到他的启动脚本,自己改了一个,试了一下可以正常运行。但不知有没有什么潜在的问题,请指教。
- #!/bin/bash
- #
- # Startup script for the Very Secure FTP Server
- #
- # chkconfig: - 98 13
- # description: VSFTPD is a secure FTP server.
- #
- # processname: vsftpd
- # pidfile: /var/run/vsftpd.pid
- # config: /etc/vsftpd.conf
- # Source function library.
- . /etc/rc.d/init.d/functions
- vsftpd=/usr/local/sbin/vsftpd
- prog=vsftpd
- RETVAL=0
- start() {
- # Start daemons.
- if [ -n "`/sbin/pidof $prog`" ]; then
- echo -n $"$prog: already running"
- echo
- return 1
- fi
- echo -n $"Starting $prog: "
-
- # Since vsftpd doesn't return proper exit codes at the moment
- # ,we can't use daemon here - emulate
- # its functionality
- base=$prog
- $vsftpd &
- RETVAL=$?
- usleep 100000
- if [ -z "`/sbin/pidof $prog`" ]; then
- # The child processes have died after fork()ing
- RETVAL=1
- fi
-
- [ $RETVAL -ne 0 ] && failure $"$base startup"
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog && /sbin/pidof $prog >; /var/run/vsftpd.pid && success $"$base startup"
- echo
- return $RETVAL
- }
- stop() {
- echo -n $"Stopping $prog: "
- killall $vsftpd
- RETVAL=$?
- [ $RETVAL != 0 ] && failure $"$base shutdown" || success $"$base shutdown"
- echo
- [ $RETVAL = 0 ] && rm -f /var/lock/subsys/vsftpd /var/run/vsftpd.pid
- }
- reload() {
- echo -n $"Reloading $prog: "
- # check13 || exit 1
- killproc $vsftpd -HUP
- # /usr/bin/killall -HUP `/sbin/pidof -o %PPID vsftpd`
- RETVAL=$?
- echo
- }
- # See how we were called.
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status $vsftpd
- RETVAL=$?
- ;;
- restart)
- stop
- start
- ;;
- condrestart)
- if [ -f /var/run/vsftpd.pid ] ; then
- stop
- start
- fi
- ;;
- reload)
- reload
- ;;
- *)
- echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
- exit 1
- esac
- exit $RETVAL
复制代码 |
|