HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Shell errors
Operating System - Linux
1833189
Members
2848
Online
110051
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-27-2004 07:54 PM
06-27-2004 07:54 PM
Shell errors
Dear gurus,
How can trap shell messages (stdout/stderr) into a perl script?.
For example:
I want to trap my faild jobs (in cron) and email me using perl script.
I don't want cron to send me mail for security reasons.
Thanks
How can trap shell messages (stdout/stderr) into a perl script?.
For example:
I want to trap my faild jobs (in cron) and email me using perl script.
I don't want cron to send me mail for security reasons.
Thanks
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2004 08:44 PM
06-27-2004 08:44 PM
Re: Shell errors
Well, you could pipe the output into a perl script with something like this.
scriptname.sh 2>&1 | perl_script.pl
This will work with cron or anything else in fact.
If the perl script reads it will get both the errors and the normal output in the above case.
scriptname.sh 2>&1 | perl_script.pl
This will work with cron or anything else in fact.
If the perl script reads
Never preceed any demonstration with anything more predictive than "watch this"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 02:28 AM
06-29-2004 02:28 AM
Re: Shell errors
Try somethink like
command 2> /tmp/$$.err || \
errorMail.pl /tmp/$$.err
rm $$.err
This will send the stderr output if command
exits with an error status.
Or
command 2> /tmp/$$.err
[ -s /tmp/$$.err ] && errorMail.pl /tmp/$$.err
rm $$.err
This will send an email if you have output on
stderr.
command 2> /tmp/$$.err || \
errorMail.pl /tmp/$$.err
rm $$.err
This will send the stderr output if command
exits with an error status.
Or
command 2> /tmp/$$.err
[ -s /tmp/$$.err ] && errorMail.pl /tmp/$$.err
rm $$.err
This will send an email if you have output on
stderr.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP