create some more bin files for 2.6
[openwrt.git] / package / reaim / files / reaim.init
1 #! /bin/sh
2
3 PATH=/sbin:/bin:/usr/sbin:/usr/bin
4 NAME=reaim
5 DESC="Transparent proxy for IM behind NAT"
6 . /etc/functions.sh
7 WAN=$(nvram get wan_ifname)
8 IPT=/usr/sbin/iptables
9 case "$1" in
10 start)
11 if [ -e /var/run/$NAME.pid ]; then
12 echo "$DESC: $NAME already started."
13 exit 0
14 fi
15 echo -n "Starting $DESC: $NAME"
16 $IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
17 $IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
18 $IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
19 $IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
20
21 test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid
22 /usr/sbin/$NAME
23 echo "."
24 ;;
25
26 stop)
27 if [ ! -e /var/run/$NAME.pid ]; then
28 echo "$DESC: $NAME is not running."
29 exit 0
30 fi
31 echo -n "Stopping $DESC: $NAME"
32 killall $NAME
33 rm -f /var/run/$NAME.pid
34
35 echo "."
36 ;;
37
38 restart|force-reload)
39 if [ ! -e /var/run/$NAME.pid ]; then
40 $0 start
41 exit 0
42 fi
43 echo -n "Restarting $DESC: $NAME"
44 $IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
45 $IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
46 $IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
47 $IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
48 killall $NAME
49 sleep 1
50 /usr/sbin/$NAME
51 echo "."
52 ;;
53
54 *)
55 N=/etc/init.d/$NAME
56 echo "Usage: $N {start|stop|restart|force-reload}" >&2
57 exit 1
58 ;;
59
60 esac
61
62 exit 0
This page took 0.054943 seconds and 5 git commands to generate.