mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
add reaim (thanks to Florian Fainelli)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2072 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
62
package/reaim/files/reaim.init
Normal file
62
package/reaim/files/reaim.init
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user