- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2005 05:44 PM
09-26-2005 05:44 PM
I need to know a shell script which does a nslookup on the names abc.xx.com and xyz.ab.com every 10 minutes and records the output in a file.
Please suggest the script.
Thanks,
Shiv
Solved! Go to Solution.
- Tags:
- nslookup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2005 05:51 PM
09-26-2005 05:51 PM
Solution# User input
LOGFILE=/tmp/nslookup.log
host1=abc.xx.com
host2=xyz.ab.com
stime=600
while [ 1 ]
do
nslookup -q $host1>> $LOGFILE
nslookup -q $host2 >> $LOGFILE
sleep $stime
done
exit 0
# END #
It will update in to /tmp/nslookup.log. You can change user inputs.
# Running script
# chmod u+x script.ksh
# ./script.ksh &
# tail -f /tmp/nslookup.log
hth.
- Tags:
- sleep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2005 05:52 PM
09-26-2005 05:52 PM
Re: shell script
Use the following script.
hosts="abc.xx.com xyz.ab.com"
i=1
while [ $i -eq 1 ]
do
for str in $hosts
do
nslookup $str >>output_file 2>&1
if [ $? -ne 0 ]
then
echo "There is problem while nslookup $str" >>output_file 2>&1
i=0
fi
done
sleep 10
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2005 05:55 PM
09-26-2005 05:55 PM
Re: shell script
#!/bin/ksh
# User input
# script.ksh
LOGFILE=/tmp/nslookup.log
ERRLOG=/tmp/nslookup.err
host1=abc.xx.com
host2=xyz.ab.com
touch $ERRLOG $LOGFILE
nslookup -q $host1>> $LOGFILE 2>>$ERRLOG
nslookup -q $host2 >> $LOGFILE 2>>$ERRLOG
exit 0
# END #
# Crontab Setting
0,10,20,30,40,50 * * * * /tmp/script.ksh 1>/dev/null 2>&1
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2005 06:33 PM
09-26-2005 06:33 PM
Re: shell script
you can also have a look at Openview products for some advance monitoring and notification features... however, you will have to pay for this.
kind regards
yogeeraj