- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mailx and cron
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
07-08-2002 05:44 AM
07-08-2002 05:44 AM
omnistat -previous -last 1 | mailx -s "Omnistat last day"
-> this was working fine (I received the mail in my ofice)
Now I'm trying to put it in a shell script, that I can send the status in error situations only. The script is working fine (I receive a mail), when I start the script manually. But from cron it is not working. Here is the script:
#!/usr/bin/ksh
# **************************************
#
# Function: Check Omniback backup tasks and send a mail
# in case of errors
#
# Author: D.Kilian
#
# Date: 2002/07/08
#
# **************************************
mail_addr=dirk@nokia-ocd.com
temp_file=/tmp/omnistat.lst
export mail_addr
export temp_file
/opt/omni/bin/omnistat -previous -last 1 > ${temp_file}
if [ `cat ${temp_file} | grep -E 'Failed | Errors' | wc -l` -gt 0 ]
then
cat ${temp_file} | mailx -s "Backup Failure Omniback yesterday" ${mail_addr}
fi
rm ${temp_file}
*************************
So what's my mistake?
Dirk
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 06:03 AM
07-08-2002 06:03 AM
Re: mailx and cron
You need to use the full path to your commands (cat, mailx, etc), or define your path:
PATH=/usr/bin:/sbin:/usr/sbin
export PATH
Hope this helps
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 06:13 AM
07-08-2002 06:13 AM
SolutionDo you know if the job is started at all ?
If it is started, do you get any errors ? I am not quite sure how cronjob errors are handled but it is always possible to redirect stdout and stderr of your script to a temporary file.
Which version of OmniBack do you use, there are perhaps easier ways to mail session status.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 06:37 AM
07-08-2002 06:37 AM
Re: mailx and cron
thank you for your answers. Both were helpful. But the best was the hint to redirect the output of stderr to a temp file. There I saw my mistake. I gave cron a wrong location of my script. Now it is working.
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 06:39 AM
07-08-2002 06:39 AM
Re: mailx and cron
Also in case you have croned the job any failures or the o/p message get mailed to root by default so you can also check the mail for the root bi eithe mail or vi /var/mail/root and check for the messges for that time in that file .
Manoj Srivastava