AIX25
asked on
AIX -- How do I create a ping shell script
I need help creating a shell script using ping. I need it to check the network and see if its up every 5 mins. If the script finds the network up, I want it to go back to sleep. However if it finds the network down to check it 3 times in 5 min intervals. By the third check, if the the network is still down to shutdown the server.
*I am running AIX 5.3
*I am running AIX 5.3
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The command I gave you just fills the variable 'gw' with an IP address.
You'll have to issue 'echo $gw' to view the variable's contents.
You'll have to issue 'echo $gw' to view the variable's contents.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@kishored - thanks for using my 'lsattr' thing. Seems to be useful, right?
@AIX25 - try that piece. Looks sensible, in a way.
wmp
@AIX25 - try that piece. Looks sensible, in a way.
wmp
... I just saw the -r flag of shutdown (=reboot). I think this doesn't make sense regarding your requirement, should it be the same as in your 'ifconfig' question.
yes...it should have been shutdown -Fh.....
sorry for the mistake
Thanks...wmp...thanks for the lsattr thingy...hope this solves the problem
Best of luck!
sorry for the mistake
Thanks...wmp...thanks for the lsattr thingy...hope this solves the problem
Best of luck!
ASKER
I do not know any shell scripting. Do I copy the script EXACTLY?? Also, would you be able to include where I have to enter my certain ip address or any other significant info based of my server. One final request, can you give me a short explanation of each line on the script.
Thank you very much
Thank you very much
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@woolmilkporc:
When I name the script, do I need to put a .ksh extension?
Do I execute the script with ./sample_script or ksh -x sample_script?
Finally, in the inittab, what will I need to put in the script to indicate to the inittabe to execute the sample_script??
Thank you!
When I name the script, do I need to put a .ksh extension?
Do I execute the script with ./sample_script or ksh -x sample_script?
Finally, in the inittab, what will I need to put in the script to indicate to the inittabe to execute the sample_script??
Thank you!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Also I ran #gw=$(lsattr -El inet0 | grep route | cut -d"," -f6 | cut -d" " -f1) and nothing came back or no output.
Thank you