#!/bin/sh # # frox FROX # # chkconfig: 2345 90 25 # description: FROX Transparent FTP proxy # Source function library . /etc/rc.d/init.d/functions # Configuration file. . /etc/sysconfig/frox RETVAL=0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/frox ]; then if [ ! "$IPCHAINS_RULE" ] && [ ! "$IPTABLES_RULE" ]; then echo $(nls "Please edit /etc/sysconfig/frox")' !' exit 6 fi msg_starting frox daemon frox -f /etc/frox.conf RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/frox if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ]; then run_cmd "Redirecting FTP traffic" /usr/sbin/iptables -t nat -A $IPTABLES_RULE fi if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ]; then run_cmd "Redirecting FTP traffic" /sbin/ipchains -A $IPCHAINS_RULE fi else msg_already_running frox fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/frox ]; then if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ]; then run_cmd "Removing FTP traffic redirection" /usr/sbin/iptables -t nat -D $IPTABLES_RULE fi if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ]; then run_cmd "Removing FTP traffic redirection" /sbin/ipchains -D $IPCHAINS_RULE fi msg_stopping frox killproc frox rm -f /var/lock/subsys/frox /var/run/frox.pid >/dev/null 2>&1 else msg_not_running frox fi ;; status) status frox exit $? ;; restart|force-reload) $0 stop $0 start exit $? ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 ;; esac exit $RETVAL