- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting
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
12-12-2005 09:09 AM
12-12-2005 09:09 AM
Scripting
Thanks,
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:15 AM
12-12-2005 09:15 AM
Re: Scripting
#!/usr/bin/sh
SERVER_LIST=$(cat server_list_file)
for SERVER in ${SERVER_LIST}
do
ping ${SERVER} -n 1 > /dev/null
RC=$?
if [ ${RC} -ne 0 ];
then
echo "Ping to ${SERVER} failed!"
fi
done
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:16 AM
12-12-2005 09:16 AM
Re: Scripting
#!/usr/bin/sh
SERVER_LIST=$(cat server_list_file)
for SERVER in ${SERVER_LIST}
do
/etc/ping ${SERVER} -n 1 > /dev/null
RC=$?
if [ ${RC} -ne 0 ];
then
echo "Ping to ${SERVER} failed!"
fi
done
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:18 AM
12-12-2005 09:18 AM
Re: Scripting
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:29 AM
12-12-2005 09:29 AM
Re: Scripting
echo "Ping to ${SERVER} failed!"
to
mailx -s "Ping to ${SERVER} failed!" you@yourdomain.com
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:29 AM
12-12-2005 09:29 AM
Re: Scripting
echo "Ping to ${SERVER} failed!"
to
mailx -s "Ping to ${SERVER} failed!" you@yourdomain.com
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:31 AM
12-12-2005 09:31 AM
Re: Scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:47 AM
12-12-2005 09:47 AM
Re: Scripting
Using Jeff's script, build a file in the directory in which your script resides. Now specify it's name as shown:
SERVER_LIST=$(cat /yourdir/server_list_file)
The file can contain either ipaddresses or hostnames (assuming that you have DNS configured) or both, like:
10.11.10.123
herhost
hishost
10.11.10.456
The script as written only looks at the first whitespace delimited field.
Geoff's post after Jeff's tells you how to send the email notice.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 09:53 AM
12-12-2005 09:53 AM
Re: Scripting
darrell.miracle@us.army.mil; john.doe@us.army.mil; jan.doe@us.army.mil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 10:06 AM
12-12-2005 10:06 AM
Re: Scripting
Stack you multiple email destinations like this:
darrell.miracle@us.army.mil john.doe@us.army.mil jan.doe@us.army.mil
For example:
# mailx -s "Test!" < /dev/null darrell.miracle@us.army.mil john.doe@us.army.mil jan.doe@us.army.mil
...would send the three recipients a message with the subject line "Test!" but an empty message body.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 11:07 AM
12-12-2005 11:07 AM
Re: Scripting
mailx -s "Ping to ${SERVER} failed!" `cat /usr/local/mailadmin.list`
That way, if you have multiple scripts, instead of updating each of them when you have to add or remove an admin - you only need to update 1 file - the mailadmin.list.
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2005 02:00 AM
12-13-2005 02:00 AM
Re: Scripting
Geoff uses a file to send to multiple email addresses; I use an email alias, like so:
In /etc/mail/aliases --
admins : mark_ellzey@myco.com, other_admin@myco.com, yetanother_admin@myco.com
Then you can do:
mailx -s "Ping results" admins < message
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2005 02:06 AM
12-13-2005 02:06 AM
Re: Scripting
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2005 02:36 AM
12-13-2005 02:36 AM
Re: Scripting
#!/usr/bin/sh
MSG_FILE=/var/tmp/ping_msg
SERVER_LIST=$(cat server_list_file)
EMAIL_LIST=$(cat email_list_file)
for SERVER in ${SERVER_LIST}
do
/etc/ping ${SERVER} -n 1 > /dev/null
RC=$?
if [ ${RC} -ne 0 ];
then
echo "Ping to ${SERVER} failed!" >> ${MSG_FILE}
fi
done
if [ -f ${MSG_FILE} ];
then
mailx -s "Ping failures" ${EMAIL_LIST} < ${MSG_FILE}
rm ${MSG_FILE}
fi
Jeff Traigle