]>
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 | |
81c4c6f8 | 21 | elif [ -x /usr/sbin/pure-config.pl -a -x /usr/bin/perl ] ; then |
2b83cc9c | 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 | |
37028358 | 26 | echo 'Error: pure-config{,.pl,.py} not found. Giving up.' |
2b83cc9c | 27 | exit 1 |
81c4c6f8 | 28 | fi |
2b83cc9c | 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 | msg_network_down pure-ftpd |
34 | exit 1 | |
35 | fi | |
36 | else | |
37 | exit 0 | |
e61da7a2 AM |
38 | fi |
39 | ||
40382493 | 40 | RETVAL=0 |
e61da7a2 AM |
41 | # See how we were called. |
42 | case "$1" in | |
43 | start) | |
44 | # Check if the service is already running? | |
8d60cf00 | 45 | if [ ! -f /var/lock/subsys/pure-ftpd ]; then |
e61da7a2 | 46 | msg_starting pure-ftpd |
469b4406 | 47 | rm -f /var/run/pure-ftpd/client* |
2b83cc9c | 48 | if [ x"$CFG" = "x/usr/sbin/pure-config" ] ; then |
49 | daemon /usr/sbin/pure-ftpd \ | |
50 | $(/usr/sbin/pure-config -f /etc/ftpd/pureftpd.conf) \ | |
51 | --daemonize | |
52 | RETVAL=$? | |
53 | else | |
54 | daemon $CFG /etc/ftpd/pureftpd.conf --daemonize | |
55 | RETVAL=$? | |
56 | fi | |
8d60cf00 | 57 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pure-ftpd |
e61da7a2 | 58 | else |
8d60cf00 | 59 | msg_already_running pure-ftpd |
e61da7a2 AM |
60 | fi |
61 | ;; | |
62 | stop) | |
8d60cf00 | 63 | # Stop daemons. |
e61da7a2 | 64 | if [ -f /var/lock/subsys/pure-ftpd ]; then |
8d60cf00 | 65 | msg_stopping pure-ftpd |
66 | killproc pure-ftpd | |
67 | rm -f /var/lock/subsys/pure-ftpd > /dev/null 2>&1 | |
68 | else | |
69 | msg_not_running pure-ftpd | |
e61da7a2 AM |
70 | fi |
71 | ;; | |
72 | status) | |
73 | status pure-ftpd | |
74 | RETVAL=$? | |
75 | if [ $RETVAL -eq 0 ]; then | |
8d60cf00 | 76 | pure-ftpwho |
e61da7a2 | 77 | fi |
e61da7a2 | 78 | ;; |
40382493 | 79 | restart|force-reload) |
e61da7a2 AM |
80 | $0 stop |
81 | $0 start | |
40382493 | 82 | exit $? |
e61da7a2 AM |
83 | ;; |
84 | *) | |
40382493 | 85 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
86 | exit 3 | |
e61da7a2 AM |
87 | ;; |
88 | esac | |
89 | ||
90 | exit $RETVAL |