- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: NO mail from crontab
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
Discussions
Discussions
Forums
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
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
тАО02-08-2001 04:26 AM
тАО02-08-2001 04:26 AM
NO mail from crontab
PLease confirm!
When you submit jobs in crontab you only receive mail if the job was unsuccessful. In case the job was successful you do not receive any mail.
This is my case. Is it normal?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2001 04:34 AM
тАО02-08-2001 04:34 AM
Re: NO mail from crontab
You'll receive mail after a crotab job has executed in the following cases:
1. Job was unsuccessful
2. Job is writing to standard output or standard error without being redirected either to a file or to /dev/null.
Thus, a job like 'echo hello' will have his output (hello) mailed, while a job like 'echo hello >/dev/null 2>&1' will not.
Best regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2001 04:36 AM
тАО02-08-2001 04:36 AM
Re: NO mail from crontab
Don't forget to redirect BOTH stdout and stderr, otherwise you could get mail.
It's always better to redirect to a file as this will leave you with a trace in case all went wrong.
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2001 10:13 PM
тАО02-08-2001 10:13 PM
Re: NO mail from crontab
I have a root crontab file. It contains commands (of course). The command is having some errors and some standard output. So it should mail the root user but in fact it does not. But I can find the output in /var/spool/cron/tmp. I have no redirection to that file in my crontab file.
I am running HP-UX 11.00 on an N-Class machine. Root do get other mails from other programs.
Why root is not being mailed in this special case?
Please help and thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2001 11:07 PM
тАО02-08-2001 11:07 PM
Re: NO mail from crontab
Here is an abstract of the crontab manual page:
--QUOTE
WARNINGS
Be sure to redirect the standard output and standard error from
commands. If this is not done, any generated standard output or
standard error is mailed to the user.
--ENDQUOTE
You could try redirecting (stdout and stderr) to a file (as in 'command > /tmp/file 2>&1')
If the file isn't empty after job completion, its content is what should have been emailed without redirection.
Just in case, if you're running HP-UX 11.0, here is a link to the latest Cumulative cron/at/crontab patch
ftp://ftp.itrc.hp.com/hp-ux_patches/s700_800/11.X/PHCO_21494
Best regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2001 11:58 PM
тАО02-08-2001 11:58 PM
Re: NO mail from crontab
Your command program may have written to the /var/spool/cron/tmp directory explicitely, or it does re-directing standard output and standard error internally. What happens if you run the command under shell without cron? do you see any outputs?
~Philip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2001 05:01 AM
тАО02-09-2001 05:01 AM
Re: NO mail from crontab
set -x
exec >/tmp/trace1 2>&1
now you can see trace of your shell and analyze it.
then remove exec stament. Now all that must be redirected to mail. See also /var/mail dir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-14-2001 10:06 PM
тАО02-14-2001 10:06 PM
Re: NO mail from crontab
Something strange happened. After having done the tests you guys told me. (Adding redirection and so) and returning the crontab file to its original contents, I began receiving mail from cron once again. I do not understand how the problem was solved. The administrators of the system asssured me they did nothing.
Nevertheless thanks for all your help and your precious time.
Regards
Fouad