]>
Commit | Line | Data |
---|---|---|
ec496050 | 1 | #!/bin/sh |
2 | # | |
3 | # frox FROX | |
4 | # | |
5 | # chkconfig: 2345 90 25 | |
6 | # description: FROX Transparent FTP proxy | |
7 | ||
8 | # Source function library | |
9 | . /etc/rc.d/init.d/functions | |
10 | ||
66c56dbd JK |
11 | # Configuration file. |
12 | . /etc/sysconfig/frox | |
13 | ||
ec496050 | 14 | # See how we were called. |
15 | case "$1" in | |
16 | start) | |
17 | # Check if the service is already running? | |
18 | if [ ! -f /var/lock/subsys/frox ]; then | |
288d07a9 | 19 | if [ ! "$IPCHAINS_RULE" ] && [ ! "$IPTABLES_RULE" ]; then |
20 | echo "Please edit /etc/sysconfig/frox !" | |
21 | exit 1 | |
22 | fi | |
ec496050 | 23 | msg_starting frox |
24 | daemon frox -f /etc/frox.conf | |
25 | RETVAL=$? | |
26 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/frox | |
66c56dbd | 27 | if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ] ; then |
288d07a9 | 28 | action "Redirecting FTP traffic" /usr/sbin/iptables -t nat -A $IPTABLES_RULE |
66c56dbd JK |
29 | fi |
30 | if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ] ; then | |
31 | action "Redirecting FTP traffic" /sbin/ipchains -A $IPCHAINS_RULE | |
32 | fi | |
288d07a9 | 33 | |
ec496050 | 34 | else |
35 | msg_Already_Running frox | |
36 | exit 1 | |
37 | fi | |
38 | ;; | |
39 | stop) | |
40 | # Stop daemons. | |
41 | if [ -f /var/lock/subsys/frox ]; then | |
66c56dbd JK |
42 | if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ] ; then |
43 | action "Removing FTP traffic redirection" /usr/sbin/iptables -D $IPTABLES_RULE | |
44 | fi | |
45 | if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ] ; then | |
46 | action "Removing FTP traffic redirection" /sbin/ipchains -D $IPCHAINS_RULE | |
47 | fi | |
ec496050 | 48 | msg_stopping frox |
49 | killproc frox | |
50 | rm -f /var/lock/subsys/frox /var/run/frox.pid >/dev/null 2>&1 | |
51 | else | |
52 | msg_Not_Running frox | |
53 | exit 1 | |
54 | fi | |
55 | ;; | |
56 | status) | |
57 | status frox | |
58 | exit $? | |
59 | ;; | |
60 | restart|reload) | |
61 | $0 stop | |
62 | $0 start | |
63 | ;; | |
64 | *) | |
65 | msg_Usage "$0 {start|stop|restart|status}" | |
66 | exit 1 | |
67 | ;; | |
68 | esac | |
69 | ||
70 | exit $RETVAL | |
71 |