]>
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 | ||
18 | # Check that networking is up. | |
19 | if is_no "${NETWORKING}"; then | |
20 | # nls "ERROR: Networking is down. %s can't be run." <service> | |
21 | msg_Network_Down pure-ftpd | |
22 | exit 1 | |
23 | fi | |
24 | ||
25 | if [ -f /etc/ftpd/pureftpd.conf ]; then | |
26 | PUREFTPD_OPTS=$(grep -E -v "^\W*#" /etc/ftpd/pureftpd.conf | xargs) | |
27 | fi | |
28 | ||
29 | if [ -f /etc/ftpd/pureftpd-mysql.conf ]; then | |
4bd2c465 | 30 | PUREFTPD_OPTS="${PUREFTPD_OPTS} -l mysql:/etc/ftpd/pureftpd-mysql.conf" |
e61da7a2 AM |
31 | fi |
32 | ||
33 | # See how we were called. | |
34 | case "$1" in | |
35 | start) | |
36 | # Check if the service is already running? | |
37 | if [ ! -f /var/lock/subsys/pure-ftpd ]; then | |
38 | msg_starting pure-ftpd | |
39 | daemon pure-ftpd $PUREFTPD_OPTS --daemonize | |
40 | RETVAL=$? | |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pure-ftpd | |
42 | else | |
43 | msg_Already_Running pure-ftpd | |
44 | exit 1 | |
45 | fi | |
46 | ;; | |
47 | stop) | |
48 | # Stop daemons. | |
49 | if [ -f /var/lock/subsys/pure-ftpd ]; then | |
50 | msg_stopping pure-ftpd | |
51 | killproc pure-ftpd | |
52 | rm -f /var/lock/subsys/pure-ftpd > /dev/null 2>&1 | |
53 | else | |
54 | msg_Not_Running pure-ftpd | |
55 | exit 1 | |
56 | fi | |
57 | ;; | |
58 | status) | |
59 | status pure-ftpd | |
60 | RETVAL=$? | |
61 | if [ $RETVAL -eq 0 ]; then | |
62 | pure-ftpwho | |
63 | fi | |
64 | exit $RETVAL | |
65 | ;; | |
66 | restart|reload) | |
67 | $0 stop | |
68 | $0 start | |
69 | ;; | |
70 | *) | |
71 | msg_Usage "$0 {start|stop|restart|status}" | |
72 | exit 1 | |
73 | ;; | |
74 | esac | |
75 | ||
76 | exit $RETVAL | |
77 |