|
-
You could do something like...
for f in `grep SID tnsnames.ora | awk -F= '{print $2}' | cut -d")" -f1`
do
tnsping $f | grep FAILED >> tnsping.log
done
And then do another for loop to do the nslookup on the hostnames. Just replace SID with HOST and tnsping with nslookup. Direct the results to a different logfile if necessary.
However, this will only log the lines that say FAILED... not what failed. To do that, remove the | grep FAILED after tnsping $f. That will log all results to the file. You could then have another script that greps for FAILED ( or whatever for nslookup ) in the logfile. You could even set it up to have it page or email you that there was a failure so you can go check the log.
Keep in mind, depending on how often you run this, you may need to purge your logfile once in awhile as it could grow quite large.
Good luck!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|