]>
Commit | Line | Data |
---|---|---|
c5b58c01 AG |
1 | #!/bin/sh |
2 | # | |
3 | # vsftpd vsftp server | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
6 | # description: VSFTPD is a Very Secure FTP Daemon | |
7 | # | |
8 | ||
9 | # Source function library | |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Get network config | |
13 | . /etc/sysconfig/network | |
14 | ||
15 | # Check that networking is up. | |
16 | if is_yes "${NETWORKING}"; then | |
17 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
18 | msg_network_down vsftpd | |
19 | exit 1 | |
20 | fi | |
21 | else | |
22 | exit 0 | |
23 | fi | |
24 | ||
91d4dfba | 25 | start() { |
c5b58c01 AG |
26 | # Check if the service is already running? |
27 | if [ ! -f /var/lock/subsys/vsftpd ]; then | |
28 | # Check if we have 'Listen=yes' in config | |
c2c482d6 PS |
29 | if ! egrep -q '^(listen|listen_ipv6)=([Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)' /etc/vsftpd.conf; then |
30 | echo "error: Missing 'listen=yes' or 'listen_ipv6=yes' directive in /etc/vsftpd.conf!" | |
c5b58c01 AG |
31 | exit 1 |
32 | fi; | |
006dd032 AG |
33 | # try to load capability module |
34 | _modprobe capability | |
c5b58c01 AG |
35 | msg_starting vsftpd |
36 | daemon --fork /usr/sbin/vsftpd | |
37 | RETVAL=$? | |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/vsftpd | |
39 | else | |
40 | msg_already_running vsftpd | |
41 | fi | |
91d4dfba ER |
42 | } |
43 | ||
44 | stop() { | |
c5b58c01 AG |
45 | # Stop daemons. |
46 | if [ -f /var/lock/subsys/vsftpd ]; then | |
47 | msg_stopping vsftpd | |
48 | killproc vsftpd | |
49 | rm -f /var/lock/subsys/vsftpd > /dev/null 2>&1 | |
50 | else | |
51 | msg_not_running vsftpd | |
52 | fi | |
91d4dfba ER |
53 | } |
54 | ||
55 | RETVAL=0 | |
56 | # See how we were called. | |
57 | case "$1" in | |
58 | start) | |
59 | start | |
60 | ;; | |
61 | stop) | |
62 | stop | |
c5b58c01 AG |
63 | ;; |
64 | restart|force-reload) | |
91d4dfba ER |
65 | stop |
66 | start | |
c5b58c01 AG |
67 | ;; |
68 | *) | |
69 | msg_usage "$0 {start|stop|restart|force-reload}" | |
70 | exit 3 | |
71 | ;; | |
72 | esac | |
73 | ||
74 | exit $RETVAL |