X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=pure-ftpd.init;h=b414bd33b5323ec915e1f229710d6cae7a6178b3;hb=81c4c6f8b59f8d5172332036ae5a26145e13e0d8;hp=22930ab36571b18d92699cc9feec0bec92f9bd47;hpb=8d60cf002bd570b492afac7ce97b8c2b63754dd9;p=packages%2Fpure-ftpd.git diff --git a/pure-ftpd.init b/pure-ftpd.init index 22930ab..b414bd3 100644 --- a/pure-ftpd.init +++ b/pure-ftpd.init @@ -15,10 +15,21 @@ # Get service config [ -f /etc/sysconfig/pure-ftpd ] && . /etc/sysconfig/pure-ftpd +# Check for available parsers +if [ -x /usr/sbin/pure-config ] ; then + CFG=/usr/sbin/pure-config +elif [ -x /usr/sbin/pure-config.pl -a -x /usr/bin/perl ] ; then + CFG=/usr/sbin/pure-config.pl +elif [ -x /usr/sbin/pure-config.py -a -x /usr/bin/python ] ; then + CFG=/usr/sbin/pure-config.py +else + echo 'Error: pure-config{,.pl,.py} not found. Giving up.' + exit 1 +fi + # Check that networking is up. if is_yes "${NETWORKING}"; then - if [ ! -f /var/lock/subsys/network ]; then - # nls "ERROR: Networking is down. %s can't be run." + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down pure-ftpd exit 1 fi @@ -26,7 +37,7 @@ else exit 0 fi - +RETVAL=0 # See how we were called. case "$1" in start) @@ -34,12 +45,18 @@ case "$1" in if [ ! -f /var/lock/subsys/pure-ftpd ]; then msg_starting pure-ftpd rm -f /var/run/pure-ftpd/client* - daemon pure-config.pl /etc/ftpd/pureftpd.conf --daemonize - RETVAL=$? + if [ x"$CFG" = "x/usr/sbin/pure-config" ] ; then + daemon /usr/sbin/pure-ftpd \ + $(/usr/sbin/pure-config -f /etc/ftpd/pureftpd.conf) \ + --daemonize + RETVAL=$? + else + daemon $CFG /etc/ftpd/pureftpd.conf --daemonize + RETVAL=$? + fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pure-ftpd else msg_already_running pure-ftpd - exit 1 fi ;; stop) @@ -50,7 +67,6 @@ case "$1" in rm -f /var/lock/subsys/pure-ftpd > /dev/null 2>&1 else msg_not_running pure-ftpd - exit 1 fi ;; status) @@ -59,15 +75,15 @@ case "$1" in if [ $RETVAL -eq 0 ]; then pure-ftpwho fi - exit $RETVAL ;; - restart|reload) + restart|force-reload) $0 stop $0 start + exit $? ;; *) - msg_usage "$0 {start|stop|restart|reload|status}" - exit 1 + msg_usage "$0 {start|stop|restart|force-reload|status}" + exit 3 ;; esac