Can anyone help me on the following problem,
operating system = SunOS 5.9.
I have a bash redundancy script file.
Among other functionalities, the redundancy script has to do 'ifconfig', therefore I have to run the script in superuser previlage. which is very annoying.
Is there anyway I can run the script in normal user previlage and at the sametime achieve 'ifconfig' ?
Sample script
=============
#!/bin/bash
PAUSE=2
MISSED=0
MAX_MISSES=3
interface=bge0
subif=:1
netmask=255.255.0.0
broadcast=172.16.255.255
servicename=172.16.0.48
/sbin/ifconfig ${interface}${subif} plumb
/sbin/ifconfig ${interface}${subif} inet ${servicename} netmask ${netmask} broadcast ${broadcast} down
# start the processes over here
while true;do
if ! ping 172.16.0.48 1 &> /dev/null ; then
MISSED=`expr $MISSED + 1`
echo "MISSED: $MISSED"
fi
if [ $MISSED -eq $MAX_MISSES ]; then
echo "Need to do a switch over"
/sbin/ifconfig ${interface}${subif} up
grarp ${interface} ${servicename}
# 1. Stop the processes over here
sleep $PAUSE
# restart the processes over here.
MISSED=0
fi
sleep $PAUSE
done
Thanks and Regards,
Vinoth
Vinoth.ilango@gmail.com