]> git.pld-linux.org Git - packages/pure-ftpd.git/blame_incremental - pure-ftpd.init
- release 6
[packages/pure-ftpd.git] / pure-ftpd.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# pureftpd PureFTPD server
4#
5# chkconfig: 345 85 15
6# description: PureFTPD is fast, production-quality, standard-conformant FTP server
7#
8
9# Source function library
10. /etc/rc.d/init.d/functions
11
12# Get network config
13. /etc/sysconfig/network
14
15# Get service config
16[ -f /etc/sysconfig/pure-ftpd ] && . /etc/sysconfig/pure-ftpd
17
18# Check for available parsers
19if [ -x /usr/sbin/pure-config ] ; then
20 CFG=/usr/sbin/pure-config
21elif [ -x /usr/sbin/pure-config.pl -a -x /usr/bin/perl ] ; then
22 CFG=/usr/sbin/pure-config.pl
23elif [ -x /usr/sbin/pure-config.py -a -x /usr/bin/python ] ; then
24 CFG=/usr/sbin/pure-config.py
25else
26 echo 'Error: pure-config{.pl,py} not found. Giving up.'
27 exit 1
28fi
29
30# Check that networking is up.
31if is_yes "${NETWORKING}"; then
32 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
33 # nls "ERROR: Networking is down. %s can't be run." <service>
34 msg_network_down pure-ftpd
35 exit 1
36 fi
37else
38 exit 0
39fi
40
41RETVAL=0
42# See how we were called.
43case "$1" in
44 start)
45 # Check if the service is already running?
46 if [ ! -f /var/lock/subsys/pure-ftpd ]; then
47 msg_starting pure-ftpd
48 rm -f /var/run/pure-ftpd/client*
49 if [ x"$CFG" = "x/usr/sbin/pure-config" ] ; then
50 daemon /usr/sbin/pure-ftpd \
51 $(/usr/sbin/pure-config -f /etc/ftpd/pureftpd.conf) \
52 --daemonize
53 RETVAL=$?
54 else
55 daemon $CFG /etc/ftpd/pureftpd.conf --daemonize
56 RETVAL=$?
57 fi
58 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pure-ftpd
59 else
60 msg_already_running pure-ftpd
61 fi
62 ;;
63 stop)
64 # Stop daemons.
65 if [ -f /var/lock/subsys/pure-ftpd ]; then
66 msg_stopping pure-ftpd
67 killproc pure-ftpd
68 rm -f /var/lock/subsys/pure-ftpd > /dev/null 2>&1
69 else
70 msg_not_running pure-ftpd
71 fi
72 ;;
73 status)
74 status pure-ftpd
75 RETVAL=$?
76 if [ $RETVAL -eq 0 ]; then
77 pure-ftpwho
78 fi
79 ;;
80 restart|force-reload)
81 $0 stop
82 $0 start
83 exit $?
84 ;;
85 *)
86 msg_usage "$0 {start|stop|restart|force-reload|status}"
87 exit 3
88 ;;
89esac
90
91exit $RETVAL
This page took 0.074922 seconds and 4 git commands to generate.