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-09-2003 09:13 AM
06-09-2003 09:13 AM
cron
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 09:21 AM
06-09-2003 09:21 AM
Re: cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 09:27 AM
06-09-2003 09:27 AM
Re: cron
One approach is to create a wrapper script that will capture the log and send it to the user. It may look like
script_wrapper
#!/usr/bin/ksh
USER=yourid@youruser.com
LOG=/tmp/log$$
/your_path/your_script > $LOG 2>&1
mailx -s "Out put of your_script" $USER < $LOG
Put the above script into the cron.
One more approach is to put the mailx directly into the cront
* * * * * /your_path/Your_script |mailx -s "cronout" yourid@youruser.com
I would actually create an alias for your user in the system so that all the mails to your account will come to you.
Edit /etc/mail/aliases and point user to yourid@yourhost.com.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 09:29 AM
06-09-2003 09:29 AM
Re: cron
If you want to send it to a different e-mail address, then redirect your stdout (and std err) to a mail command, like so:
/path/to/command > /usr/bin/mailx -s "Cron Output" user@somewhere.com 2>$1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 09:30 AM
06-09-2003 09:30 AM
Re: cron
/path/to/command | /usr/bin/mailx -s "Cron Output" user@somewhere.com 2>$1
Need a pipe there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 09:33 AM
06-09-2003 09:33 AM
Re: cron
from man crontab:
....
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.
......
In linux, before any crontab entries you must put a line with the variable:
MAILTO=user
Frank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 10:07 AM
06-09-2003 10:07 AM
Re: cron
Edit your crontab using crontab -e or sam and add the following to the crontab line:
| mailx -s "Subject you want" user@domain.com 2>$1
Note that I am starting this with a pipe.
Regards,
DR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 10:08 AM
06-09-2003 10:08 AM
Re: cron
Edit your crontab using crontab -e or sam and add the following to the crontab line:
| mailx -s "Subject you want" user@domain.com 2>$1
Note that I am starting this with a pipe.
Regards,
DR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2003 01:18 PM
06-10-2003 01:18 PM
Re: cron
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2003 01:26 PM
06-10-2003 01:26 PM
Re: cron
What I am seeing:
script | mailx -s "subject" mail@junk.com 2>&1
will not work like you think. That will only redirect standard error to standard out for the mailx command, NOT the script.
What you really probably want is:
script 2>&1 | mailx -s "subject" mail@junk.com
The above will redirect the standard error to standard out for the script that is run and THEN pipe that output into the mailx command. This way you get any output and errors from your script mailed to you.