Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
We run a couple of crontab as user "cronuser" on RHEL 6
although the crontab runs.. when I login to the machine as testing and type
mail
that is empty and says no email for the user "cronuser"
I assumed that on successful run of crontab it send an email to the user@machine box..
We had setup a file called .forward in the home directory of user "cronuser" with an external email address.. so that it send out all success run email of crontab to a mailing list...
this method was working for us in solaris.. not in RHEL6
How do we set this up? Basically we want to be notified to an external email address everytime crontab runs..
OK.
Does the cron daemon actually run?
What does 'crontab -l 2>&1' return for this user?
And 'cat /var/spool/cron/user? (Subst. account name.)
Are there /etc/cron.{deny,allow} files and if so is the user listed in any of them?
Are there any messages related to his account or crontab in /var/log/{messages,cron,secure}* or /var/log/audit/audit.log?
Hmm. Looks OK to me. Let's see. Could you move the ".forward" to say "backup_.forward" and replace the '/bin/ping 127.0.0.1' with something like '/bin/true|mail -s "Hello World" user@machine' and then check user@machines mail and check your mailer daemons logs?
Hmm. Looks OK to me. Let's see. Could you move the ".forward" to say "backup_.forward" and replace the '/bin/ping 127.0.0.1' with something like '/bin/true|mail -s "Hello World" user@machine' and then check user@machines mail and check your mailer daemons logs?
crontab -l
Quote:
* * * * * '/bin/mail -s "Hello World" XXXXX@XXX'
/var/log/maillog
Quote:
Oct 10 13:33:02 localhost postfix/sendmail[11363]: warning: the Postfix sendmail command has set-uid root file permissions
Oct 10 13:33:02 localhost postfix/sendmail[11363]: warning: or the command is run from a set-uid root process
Oct 10 13:33:02 localhost postfix/sendmail[11363]: warning: the Postfix sendmail command must be installed without set-uid root file permissions
Oct 10 13:33:02 localhost postfix/pickup[11143]: 1D10B2C466: uid=500 from=<root>
Oct 10 13:33:02 localhost postfix/cleanup[11302]: 1D10B2C466: message-id=<20121010023302.1D10B2C466@XXXXXXXX>
Oct 10 13:33:02 localhost postfix/qmgr[2455]: 1D10B2C466: from=<root@XXXXXXX>, size=686, nrcpt=1 (queue active)
Oct 10 13:33:02 localhost postfix/local[11304]: 1D10B2C466: to=<XXXXXXXX>, orig_to=<user>, relay=local, delay=0.06, delays=0.05/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 10 13:33:02 localhost postfix/qmgr[2455]: 1D10B2C466: removed
mail command is showing emails every minute for the user
AND in this scenario.. .forward works..
why is it not working for ping ?? or other scripts??
why is it not working for ping ?? or other scripts??
I don't know but at least you now have a workaround and can send email with the 'mail' command from the cron job itself. Should you ever find out why I'd appreciate it if you post about the real cause here.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.