diff options
author | Nicolas Thill <nico@openwrt.org> | 2005-10-07 22:44:29 +0000 |
---|---|---|
committer | Nicolas Thill <nico@openwrt.org> | 2005-10-07 22:44:29 +0000 |
commit | fe7b34efdbf394a6c8f3cba8c6c87d057da4aa90 (patch) | |
tree | 666156c4db4aedad4fb084383ab59ba96752a4b9 /openwrt/package/reaim/files | |
parent | ed6bf70bd42b1ea0cef21ffc1ba0ae6e7df5186a (diff) | |
download | mtk-20170518-fe7b34efdbf394a6c8f3cba8c6c87d057da4aa90.zip mtk-20170518-fe7b34efdbf394a6c8f3cba8c6c87d057da4aa90.tar.gz mtk-20170518-fe7b34efdbf394a6c8f3cba8c6c87d057da4aa90.tar.bz2 |
add reaim (thanks to Florian Fainelli)
SVN-Revision: 2072
Diffstat (limited to 'openwrt/package/reaim/files')
-rw-r--r-- | openwrt/package/reaim/files/reaim.init | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/openwrt/package/reaim/files/reaim.init b/openwrt/package/reaim/files/reaim.init new file mode 100644 index 0000000..93ceea3 --- /dev/null +++ b/openwrt/package/reaim/files/reaim.init @@ -0,0 +1,62 @@ +#! /bin/sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=reaim +DESC="Transparent proxy for IM behind NAT" +. /etc/functions.sh +WAN=$(nvram get wan_ifname) +IPT=/usr/sbin/iptables +case "$1" in + start) + if [ -e /var/run/$NAME.pid ]; then + echo "$DESC: $NAME already started." + exit 0 + fi + echo -n "Starting $DESC: $NAME" + $IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT + $IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT + $IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT + $IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT + + test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid + /usr/sbin/$NAME + echo "." + ;; + + stop) + if [ ! -e /var/run/$NAME.pid ]; then + echo "$DESC: $NAME is not running." + exit 0 + fi + echo -n "Stopping $DESC: $NAME" + killall $NAME + rm -f /var/run/$NAME.pid + + echo "." + ;; + + restart|force-reload) + if [ ! -e /var/run/$NAME.pid ]; then + $0 start + exit 0 + fi + echo -n "Restarting $DESC: $NAME" + $IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT + $IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT + $IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT + $IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT + killall $NAME + sleep 1 + /usr/sbin/$NAME + echo "." + ;; + + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; + +esac + +exit 0 |