]>
Commit | Line | Data |
---|---|---|
e61da7a2 AM |
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 | ||
2b83cc9c | 18 | # Check for available parsers |
19 | if [ -x /usr/sbin/pure-config ] ; then | |
20 | CFG=/usr/sbin/pure-config | |
21 | elif [ -x /usr/sbin/pure-config.pl -a -x /usr/bin/perl ] ; then | |
22 | CFG=/usr/sbin/pure-config.pl | |
23 | elif [ -x /usr/sbin/pure-config.py -a -x /usr/bin/python ] ; then | |
24 | CFG=/usr/sbin/pure-config.py | |
25 | else | |
26 | echo 'Error: pure-config{.pl,py} not found. Giving up.' | |
27 | exit 1 | |
28 | fi | |
29 | ||
e61da7a2 | 30 | # Check that networking is up. |
8d60cf00 | 31 | if is_yes "${NETWORKING}"; then |
8e007219 | 32 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
8d60cf00 | 33 | # nls "ERROR: Networking is down. %s can't be run." <service> |
34 | msg_network_down pure-ftpd | |
35 | exit 1 | |
36 | fi | |
37 | else | |
38 | exit 0 | |
e61da7a2 AM |
39 | fi |
40 | ||
40382493 | 41 | RETVAL=0 |
e61da7a2 AM |
42 | # See how we were called. |
43 | case "$1" in | |
44 | start) | |
45 | # Check if the service is already running? | |
8d60cf00 | 46 | if [ ! -f /var/lock/subsys/pure-ftpd ]; then |
e61da7a2 | 47 | msg_starting pure-ftpd |
469b4406 | 48 | rm -f /var/run/pure-ftpd/client* |
2b83cc9c | 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 | |
8d60cf00 | 58 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pure-ftpd |
e61da7a2 | 59 | else |
8d60cf00 | 60 | msg_already_running pure-ftpd |
e61da7a2 AM |
61 | fi |
62 | ;; | |
63 | stop) | |
8d60cf00 | 64 | # Stop daemons. |
e61da7a2 | 65 | if [ -f /var/lock/subsys/pure-ftpd ]; then |
8d60cf00 | 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 | |
e61da7a2 AM |
71 | fi |
72 | ;; | |
73 | status) | |
74 | status pure-ftpd | |
75 | RETVAL=$? | |
76 | if [ $RETVAL -eq 0 ]; then | |
8d60cf00 | 77 | pure-ftpwho |
e61da7a2 | 78 | fi |
e61da7a2 | 79 | ;; |
40382493 | 80 | restart|force-reload) |
e61da7a2 AM |
81 | $0 stop |
82 | $0 start | |
40382493 | 83 | exit $? |
e61da7a2 AM |
84 | ;; |
85 | *) | |
40382493 | 86 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
87 | exit 3 | |
e61da7a2 AM |
88 | ;; |
89 | esac | |
90 | ||
91 | exit $RETVAL |