]> git.pld-linux.org Git - packages/frox.git/blob - frox.init
- s|/var/log/archiv|/var/log/archive|g
[packages/frox.git] / frox.init
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
11 # Configuration file.
12 . /etc/sysconfig/frox
13
14 RETVAL=0
15 # See how we were called.
16 case "$1" in
17   start)
18         # Check if the service is already running?
19         if [ ! -f /var/lock/subsys/frox ]; then
20                 if [ ! "$IPCHAINS_RULE" ] && [ ! "$IPTABLES_RULE" ]; then
21                         echo $(nls "Please edit /etc/sysconfig/frox")' !'
22                         exit 6
23                 fi
24                 msg_starting frox
25                 daemon frox -f /etc/frox.conf
26                 RETVAL=$?
27                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/frox
28                 if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ]; then
29                         run_cmd "Redirecting FTP traffic" /usr/sbin/iptables -t nat -A $IPTABLES_RULE
30                 fi
31                 if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ]; then
32                         run_cmd "Redirecting FTP traffic" /sbin/ipchains -A $IPCHAINS_RULE
33                 fi
34
35         else
36                 msg_already_running frox
37         fi
38         ;;
39   stop)
40         # Stop daemons.
41         if [ -f /var/lock/subsys/frox ]; then
42                 if [ -x /usr/sbin/iptables -a -n "$IPTABLES_RULE" ]; then
43                         run_cmd "Removing FTP traffic redirection" /usr/sbin/iptables -t nat -D $IPTABLES_RULE
44                 fi
45                 if [ -x /sbin/ipchains -a -n "$IPCHAINS_RULE" ]; then
46                         run_cmd "Removing FTP traffic redirection" /sbin/ipchains -D $IPCHAINS_RULE
47                 fi
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         fi
54         ;;
55   status)
56         status frox
57         exit $?
58         ;;
59   restart|force-reload)
60         $0 stop
61         $0 start
62         exit $?
63         ;;
64   *)
65         msg_usage "$0 {start|stop|restart|force-reload|status}"
66         exit 3
67         ;;
68 esac
69
70 exit $RETVAL
This page took 0.073453 seconds and 3 git commands to generate.