#!/bin/sh
read cncgw
echo -n "add or del: "
read option
if [ "$option" = "del" ]; then
route $option -net 1.24.0.0/13 gw $cncgw metric 1
route $option -net 223.27.184.0/22 gw $cncgw metric 1" > /etc/linux_cnc_route.sh ; chmod 755 /etc/linux_cnc_route.sh
if [ -f /etc/rc.d/rc.local ]; then
sed '/exit 0/d' /etc/rc.d/rc.local > /etc/rc.d/rc.local.a ; mv -f /etc/rc.d/rc.local.a /etc/rc.d/rc.local ; chmod 755 /etc/rc.d/rc.local
echo "/etc/linux_cnc_route.sh" >> /etc/rc.d/rc.local
/etc/linux_cnc_route.sh
else
sed '/exit 0/d' /etc/rc.local > /etc/rc.local.a ; mv -f /etc/rc.local.a /etc/rc.local ; chmod 755 /etc/rc.local
echo "/etc/linux_cnc_route.sh" >> /etc/rc.local
/etc/linux_cnc_route.sh
fi
else
echo "Unknown operation.Enter add or del."
exit 1
fi
echo "Operation is completed!"
exit 0