nslookup and ping scrips
I defined a script to report if ping & nslookup are not working, which looks like this:
************ function server_precheck_function { ping $server > /dev/null if [ $? -eq 0 ]; then exit else echo "Server not pingable" fi host $server > /dev/null if [ $? -eq 0 ]; then exit else echo "Server not Resolved" fi } server1=$(command to find server1) server2=$(command to find server2) server3=$(command to find server3) ************ I would like to call the functions server_ping_check & server_lookup_check for all 3 servers in the same script, something like this server_ping_check_function server1 server_ping_check_function server2 server_ping_check_function server3 as of now I am running the functions as individual scripts within the same script, how do I call like explained above, pls see if any one can assist. |
Use a loop:
Code:
command to find server1 server2 server3 | while read SERVER; do Code:
function howto() { echo "Bash scripting guides: *BTW also have a look at command args (esp. how many times you query, query timeouts and quiet output), realize that not being able to ping a server can have different causes (it doesn't necessarily mean a server is down) and that name lookups can be cached by subsystems like nscd or a caching name server. |
All times are GMT -5. The time now is 12:18 AM. |