- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Disabling the message generation out of cronjobs
Categories
Company
Local Language
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 02:50 AM
10-26-2005 02:50 AM
whenever I run a cronjob, it generates an email and sends it to inform it has been run. Is there a way to disable the notification when a cronjob runs based on some conditions
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 02:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 02:57 AM
10-26-2005 02:57 AM
Re: Disabling the message generation out of cronjobs
> /dev/null 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 02:58 AM
10-26-2005 02:58 AM
Re: Disabling the message generation out of cronjobs
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 03:05 AM
10-26-2005 03:05 AM
Re: Disabling the message generation out of cronjobs
Any output (STDOUT or STDERR) generated by a crontask that is not redirected to a file will be emailed to the user that submitted the job. This can be quite useful as an exception reporting mechanism, especially for STDERR when your scripts are "properly" written.
In any case, if you do not want the un-redirected output, do something like:
0 1 * * * /path/scrript > /dev/null #...discard STDOUT
0 1 * * * /path/script > /dev/null 2>&1 #...discard STDOUT + STDERR
Another way to circumvent the problem is to write your scripts to determine whether or not they have a controlling terminal. Since 'cron' jobs don't, you can begin your script with:
[ -t 0 ] || exec > /dev/null 2>&1
Regards!
...JRF...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 03:28 AM
10-26-2005 03:28 AM
Re: Disabling the message generation out of cronjobs
Like
0 * * * * /usr/local/bin/myscript.sh > /tmp/myscript.log 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 05:08 AM
10-26-2005 05:08 AM
Re: Disabling the message generation out of cronjobs
Examples:
0 5 * * 1 [ -d /var/adm/lp/XEBEC ] && /usr/local/bin/print.clean.receive >/dev/null 2>&1
0 6 21 * * [ -d /var/adm/lp/XEBEC ] && /usr/local/bin/lpqpurge >/tmp/lpqpurge.cronlog 2>&1
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2005 06:58 AM
10-26-2005 06:58 AM