- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Automating
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
тАО04-16-2009 10:27 AM
тАО04-16-2009 10:27 AM
I am running a command line virus scanner. So I set a cronjob to run it every sunday at 4:30 PM and send the output to a file in my homdir as below:
#30 16 * * 0 /usr/local/bin/uvscan/uvscan >> /home/name/scanresults
My question is how would I have these scan results automatically sent to my outlook e-mail address? Would I just put it is the crontab after the >> /home/name/scanresults? something like :
mail -s 'Subject' somewhere@domain.com < /home/name/scanresults
or is there an easier/better way?
Solved! Go to Solution.
- Tags:
- mailx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 10:39 AM
тАО04-16-2009 10:39 AM
Re: Automating
Any output (STDOUT or STDERR) that is not redirected (to a file) when executed in a 'cron'd task is sent to the user as mail.
Hence, you could setup a '.forward' file in your ${HOME} directory that contains the line:
somewhere@domain.com
The '.forward' should be owned by the user and readable only by the same.
Otherwise, the 'mail' syntax you showed would also work.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 10:42 AM
тАО04-16-2009 10:42 AM
Re: Automating
By the way, as a 'sendmail' requirement you must (of course) have the 'DJ' macro ("smart relay") defined in your '/etc/mail/sendmail.cf' something like:
DSexchange.domain.com
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 10:49 AM
тАО04-16-2009 10:49 AM
Re: Automating
Unfortunately, we cannot have .forward file on our systems (Government regulation) we are allowed .alias files though. I could, in theory set it up the same yes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 10:54 AM
тАО04-16-2009 10:54 AM
Re: Automating
#30 16 * * 0 /usr/local/bin/uvscan/uvscan >> /home/name/scanresults mail -s 'scanresults' me@mine.com
would it work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 10:56 AM
тАО04-16-2009 10:56 AM
Solution> we are allowed .alias files though. I could, in theory set it up the same yes?
Yes, see the '/etc/mail/aliases' file. You might just as well 'cron' something like:
# 30 16 * * 0 /usr/local/bin/uvscan/uvscan|mailx -s "The Subject" somewhere@domain.com
...eliminating the temporary file.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 10:58 AM
тАО04-16-2009 10:58 AM
Re: Automating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 11:02 AM
тАО04-16-2009 11:02 AM
Re: Automating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2009 09:02 PM
тАО04-16-2009 09:02 PM
Re: Automating
If you want to also send stderr you would need to do:
/usr/local/bin/uvscan/uvscan 2>&1 | mailx -s "The Subject" ...