- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script output.
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
06-16-2003 08:45 AM
06-16-2003 08:45 AM
Script output.
########################################################
if [ "$BB6509LC" -ne 1 ]
then
if ping 149.197.238.180 -n 3 | grep '100% packet loss'
then
telalertc -i JeffMartin -m "Critical Switch Unreachable: BB-6509-LANCENTER"
BB6509LC=1
fi
fi
########################################################
if [ "$BB6MSFCDSTBY" -ne 1 ]
then
if ping 149.197.238.180 -n 3 | grep '100% packet loss'
then
telalertc -i JeffMartin -m "Critical Switch Unreachable: BB-6MSFC-DASD-STBY"
BB6MSFCDSTBY=1
fi
fi
########################################################
How do I get around this so my script works properly?
Thanks,
Jeff Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 08:57 AM
06-16-2003 08:57 AM
Re: Script output.
courtesy of bill hassell:
cron NEVER logs in like a normal user so nothing in /etc/profile or .profile is run. All cron jobs should set PATH explicitly (actually, all reliable scripts should do this) to avoid issues like this. And of course, specialized variables that may have been added to login profiles should also be coded into cron scripts. Use the set command in your cron job to show what your current environment contains.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:01 AM
06-16-2003 09:01 AM
Re: Script output.
Can you try to enter the full path name for ping as well as for grep? Then retry.
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:05 AM
06-16-2003 09:05 AM
Re: Script output.
The solution is to explicitly use /usr/sbin/ping.
BTW with your script you will get rubbish emailed to you; you can suppress the output of grep by doing:
...
if /usr/sbin/ping 149.197.238.180 -n 3 | grep -q '100% packet loss'
then
...
dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:07 AM
06-16-2003 09:07 AM
Re: Script output.
You'll also need the full path of the telalertc command too.
It would also be wise to have a #!/usr/bin/sh at the top of the script too (if you haven't already!)
regards,
Darren.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2003 03:59 AM
06-17-2003 03:59 AM
Re: Script output.
I do this pretty often... just redireting the output of the ping to a temp file, then grep the temp
>/tmp/isp.test
/usr/etc/ping -s64 -c1 $isp >/tmp/isp.test
if [ `cat /tmp/isp.test | grep -c "1 packets received"` = 0 ]
then