]>
Commit | Line | Data |
---|---|---|
ec496050 | 1 | #!/bin/sh |
2 | # | |
d00adad0 | 3 | # frox FROX |
ec496050 | 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 | ||
cc614af8 | 14 | RETVAL=0 |
ec496050 | 15 | # See how we were called. |
16 | case "$1" in | |
17 | start) | |
18 | # Check if the service is already running? | |
4f7a3692 | 19 | if [ ! -f /var/lock/subsys/frox ]; then |
20 | if [ ! "$IPCHAINS_RULE" ] && [ ! "$IPTABLES_RULE" ]; then | |
21 | echo $(nls "Please edit /etc/sysconfig/frox")' !' | |
cc614af8 | 22 | exit 6 |
4f7a3692 | 23 | fi |
ec496050 | 24 | msg_starting frox |
25 | daemon frox -f /etc/frox.conf | |
4f7a3692 | 26 | RETVAL=$? |
27 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/frox | |
3f5dd178 | 28 | if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ]; then |
887ef3a4 | 29 | run_cmd "Redirecting FTP traffic" /usr/sbin/iptables -t nat -A $IPTABLES_RULE |
66c56dbd | 30 | fi |
3f5dd178 | 31 | if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ]; then |
887ef3a4 | 32 | run_cmd "Redirecting FTP traffic" /sbin/ipchains -A $IPCHAINS_RULE |
66c56dbd | 33 | fi |
288d07a9 | 34 | |
ec496050 | 35 | else |
4f7a3692 | 36 | msg_already_running frox |
ec496050 | 37 | fi |
38 | ;; | |
39 | stop) | |
4f7a3692 | 40 | # Stop daemons. |
ec496050 | 41 | if [ -f /var/lock/subsys/frox ]; then |
3f5dd178 | 42 | if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ]; then |
e94f7d02 | 43 | run_cmd "Removing FTP traffic redirection" /usr/sbin/iptables -t nat -D $IPTABLES_RULE |
66c56dbd | 44 | fi |
3f5dd178 | 45 | if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ]; then |
887ef3a4 | 46 | run_cmd "Removing FTP traffic redirection" /sbin/ipchains -D $IPCHAINS_RULE |
66c56dbd | 47 | fi |
4f7a3692 | 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 | |
ec496050 | 53 | fi |
54 | ;; | |
55 | status) | |
56 | status frox | |
57 | exit $? | |
58 | ;; | |
cc614af8 | 59 | restart|force-reload) |
ec496050 | 60 | $0 stop |
61 | $0 start | |
cc614af8 | 62 | exit $? |
ec496050 | 63 | ;; |
64 | *) | |
cc614af8 | 65 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
66 | exit 3 | |
ec496050 | 67 | ;; |
68 | esac | |
69 | ||
70 | exit $RETVAL |