@@ -56,35 +56,49 @@
chown ftpsecure:nogroup /var/run/vsftpd || :
function writePidFile() {
- echo ${2} > /var/run/vsftpd/${1}.pid
+ conf=${1}
+ confname=`basename $conf .conf`
+ if [ "${confname}" == ".conf" ] ; then
+ confname="vsftpd"
+ fi
+ echo ${2} > /var/run/vsftpd/${confname}.pid
+}
+
+function getPidFileFromConf() {
+ conf=${1}
+ confname=`basename $conf .conf`
+ if [ "${confname}" == ".conf" ] ; then
+ confname="vsftpd"
+ fi
+ echo /var/run/vsftpd/${confname}.pid
}
function getPidFromConf() {
- if [ "${1}" == "" ] ; then
- conf="/etc/vsftpd.conf"
- else
- conf="${1}"
- fi
+ conf="${1}"
for PID in `pidof vsftpd` ; do
- if [ -n "`grep ${conf} /proc/${PID}/cmdline`" ] ; then
+ if [ -n "${conf}" ] ; then
+ if [ -n "`grep ${conf} /proc/${PID}/cmdline`" ] ; then
+ RPID="${PID}"
+ break;
+ fi
+ else
RPID="${PID}"
- break;
fi
done
- confname=`basename $conf .conf`
- writePidFile $confname $RPID
+ echo $RPID
}
case "$1" in
start)
echo -n "Starting vsftpd "
/sbin/startproc -l /var/log/rcvsftp.log $VSFTPD_BIN $VSFTPD_CONF
- getPidFromConf $VSFTPD_CONF
+ pid=`getPidFromConf $VSFTPD_CONF`
+ writePidFile $VSFTPD_CONF $pid
rc_status -v
;;
stop)
echo -n "Shutting down vsftpd "
- /sbin/killproc -p /var/run/vsftpd/vsftpd.pid -TERM $VSFTPD_BIN
+ /sbin/killproc -p `getPidFileFromConf $VSFTPD_CONF` -TERM $VSFTPD_BIN
rc_status -v
;;
try-restart|condrestart)
@@ -110,17 +124,17 @@
;;
force-reload)
echo -n "Reload service vsftpd "
- /sbin/killproc -p /var/run/vsftpd/vsftpd.pid -HUP $VSFTPD_BIN
+ /sbin/killproc -p `getPidFileFromConf $VSFTPD_CONF` -HUP $VSFTPD_BIN
rc_status -v
;;
reload)
echo -n "Reload service vsftpd "
- /sbin/killproc -p /var/run/vsftpd/vsftpd.pid -HUP $VSFTPD_BIN
+ /sbin/killproc -p `getPidFileFromConf $VSFTPD_CONF` -HUP $VSFTPD_BIN
rc_status -v
;;
status)
echo -n "Checking for service vsftpd "
- /sbin/checkproc -p /var/run/vsftpd/vsftpd.pid $VSFTPD_BIN
+ /sbin/checkproc -p `getPidFileFromConf $VSFTPD_CONF` $VSFTPD_BIN
rc_status -v
;;
*)
|