[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

anacron and sending email updates

I have several RHEL6 systems which I need to run a script daily.  I created the script and placed it in /etc/cron.daily/ to be run by anacron.  

In the script most of the standard output if redirected to a file.  This file is then emailed to me in the script.

What is happening is it looks like anacron is stealing the output.  The output is emailed to me by anacron with a subject of "Anacron job 'cron.daily' on <hostname>".  But the email line in my script just sends me a blank email.  

If I run the script manually, it works perfect.

Any ideas?
0
savone
Asked:
savone
1 Solution
 
TobiasHolmCommented:
Check so you have full paths in the cronjob script to all files.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
>> most of the standard output if redirected to a file
Check that other commands do not create any output. Redirect using >/dev/null if necesssary.

Output that is not redirected or 'removed' using /dev/null will cause emails being sent to you by cron

If you can't fix or find it, feel free to post a (redacted if needed) part of the script so we can help you out.
0
 
savoneAuthor Commented:
I changed it so all output is redirected, is there a way to test it without waiting for anacron to run tomorrow?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Gerwin Jansen, EE MVETopic Advisor Commented:
Well I don't use anacron myself (just cron) but you could try and adding (or changing) a line in /etc/cron.d/anacron that determines when anacron jobs can are started:

START_HOURS_RANGE=6-7

(set it to your timezone's next hour)
0
 
savoneAuthor Commented:
Ok, all my jobs ran last night.  I still received emails from anacron although they now say "Null message body, hopes thats ok!!"

Also, the script manually sends an email, which comes through as blank.  If I run the script manually the email is sent fine.  Almost like anacron is stripping the redirect into mail.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Can you post the (redacted) script?
0
 
gheistCommented:
Is the script executable and has full interpreter path inside?
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
@gheist - the script runs manually, this implies that it is executable and the full path question was in the first comment ;)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now