[opensuse] mail from cron ?
I have an 11.2 system and am having trouble configuring it to send me mail from some cron jobs. The problem is the /root/bin/cron.daily.local script. I know it runs because I have a line in it that says date >> /root/cron.dbg and the file gets a new line added every day. The script also has a mailto line and a line that prints output: MAILTO=dhoworth@my.domain.uk echo 'This is /root/bin/cron.daily.local' The sysconfig variable SEND_MAIL_ON_NO_ERROR is set to yes but I get no mail from the job. I do get mail from a job in root's crontab: SHELL=/bin/bash MAILTO=dhoworth@my.domain.uk # m h d mo dow 50 15 * * * echo hello What am I missing? :( Thanks, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, Jul 5, 2010 at 11:42 AM, Dave Howorth
I have an 11.2 system and am having trouble configuring it to send me mail from some cron jobs. The problem is the /root/bin/cron.daily.local script. I know it runs because I have a line in it that says
date >> /root/cron.dbg
and the file gets a new line added every day. The script also has a mailto line and a line that prints output:
MAILTO=dhoworth@my.domain.uk echo 'This is /root/bin/cron.daily.local'
The sysconfig variable SEND_MAIL_ON_NO_ERROR is set to yes but I get no mail from the job. I do get mail from a job in root's crontab:
SHELL=/bin/bash MAILTO=dhoworth@my.domain.uk
# m h d mo dow 50 15 * * * echo hello
What am I missing? :(
Thanks, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
What agent are you using to send the mail. I use mail and mailx, some people use mutt. I use this to set my vars //VAR Are set here.... $hostname = "tatl0wlluna.magidesign.com"; //This is a simple email to give me the status from yester day. //This connect the script to the db //To use ',' between e-mail address for multiple recipents $to = 'a@mydomain.com'; $to .=',b@mydomain.com'; //Set the Subject here... $subject = "This is my subject..."; // Mail it mail($to, $subject, $message); Hopefully that will help. -- ----------------------------------------- Discover it! Enjoy it! Share it! openSUSE Linux. ----------------------------------------- openSUSE -- en.opensuse.org/User:Terrorpup openSUSE Ambassador/openSUSE Member skype,twiiter,identica,friendfeed -- terrorpup freenode(irc) --terrorpup/lupinstein Have you tried SUSE Studio? Need to create a Live CD, an app you want to package and distribute , or create your own linux distro. Give SUSE Studio a try. www.susestudio.com. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2010-07-05 17:56, Chuck Payne wrote:
On Mon, Jul 5, 2010 at 11:42 AM, Dave Howorth <> wrote:
I have an 11.2 system and am having trouble configuring it to send me mail from some cron jobs. The problem is the /root/bin/cron.daily.local script. I know it runs because I have a line in it that says
date >> /root/cron.dbg
Instead, in "/etc/sysconfig/cron" set this: SYSLOG_ON_NO_ERROR="yes" This will write an entry in the syslog (/var/log/message file) when the jobs run: Jul 4 20:15:01 Elessar run-crons[26711]: mcelog: OK Jul 4 21:15:01 Elessar run-crons[27800]: mcelog: OK Jul 4 22:00:24 Elessar run-crons[30397]: beagle-crawl-system: OK Jul 4 22:00:24 Elessar run-crons[30397]: logrotate: OK Jul 4 22:00:24 Elessar run-crons[30397]: suse-clean_catman: OK Jul 4 22:01:52 Elessar run-crons[30397]: suse-do_mandb: OK Jul 4 22:02:02 Elessar run-crons[30397]: suse-texlive: OK
and the file gets a new line added every day. The script also has a mailto line and a line that prints output:
MAILTO=dhoworth@my.domain.uk echo 'This is /root/bin/cron.daily.local'
Try that first with a local user in that machine, like "root" or "dhoworth". In order to be able to sent outside, your "from" domain has got to be real, or the destination will reject it as a spammer. And the "from" will be set to something like "cron@yourmachinename.yourdomain". Check the mail log in any case to be sure.
The sysconfig variable SEND_MAIL_ON_NO_ERROR is set to yes but I get no mail from the job. I do get mail from a job in root's crontab:
SHELL=/bin/bash MAILTO=dhoworth@my.domain.uk
Ah, you do... Then, check the logs. First do the change I suggested above, then look at the mail log and the system logs.
What am I missing? :(
What agent are you using to send the mail. I use mail and mailx, some people use mutt.
You don't need an agent, or not one you can choose: it is choosen by the suse people that wrote the cron system jobs. Ie: "mail": if [ -n "${STATUS}" -o "$SEND_MAIL_ON_NO_ERROR" = "yes" ] ; then mail ${SEND_TO} -s "${TITLE}" < ${CONTROL_MAIL} fi - -- Cheers / Saludos, Carlos E. R. (from 11.2 x86_64 "Emerald" GM (Elessar)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAkwyBWAACgkQU92UU+smfQWk6ACghrePT40GvTVcX6MORN/JX8rW rwcAmwWdf54R1jcU9WgddFHZQDgse6zw =FnN4 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Dave Howorth wrote:
I have an 11.2 system and am having trouble configuring it to send me mail from some cron jobs. The problem is the /root/bin/cron.daily.local script. I know it runs because I have a line in it that says
date >> /root/cron.dbg
and the file gets a new line added every day. The script also has a mailto line and a line that prints output:
MAILTO=dhoworth@my.domain.uk echo 'This is /root/bin/cron.daily.local'
The sysconfig variable SEND_MAIL_ON_NO_ERROR is set to yes but I get no mail from the job. I do get mail from a job in root's crontab:
SHELL=/bin/bash MAILTO=dhoworth@my.domain.uk
# m h d mo dow 50 15 * * * echo hello
What am I missing? :(
Did you check your mail logs? If mails are failing, you ought to see that in the log. -- Per Jessen, Zürich (18.2°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos E. R. wrote:
Check the mail log in any case to be sure.
Doh! I don't know why I hadn't already done that (and thanks to Per for also suggesting it). It makes things a lot more clear! :) cron is sending mail for every cron run to root, which is being redirected to dhoworth on the same machine and is delivered to his/my local mailbox on that machine (which I don't use). I actually want mail to root redirected to my real mail address, so I'll need to dig around in the configuration to discover what I did wrong. The mail sent for the daily cron jobs includes the output from the cron.daily.local so at least I've found that. I now just need to arrange for that output to be produced even when I turn off the email logging for every cron run. Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 07/06/2010 05:36 AM, Dave Howorth wrote:
I actually want mail to root redirected to my real mail address, so I'll need to dig around in the configuration to discover what I did wrong.
You could alias that in postfix so all root goes to you, no? -- Michael S. Dunsavage -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2010-07-06 11:36, Dave Howorth wrote:
Carlos E. R. wrote:
Check the mail log in any case to be sure.
Doh! I don't know why I hadn't already done that (and thanks to Per for also suggesting it). It makes things a lot more clear! :)
cron is sending mail for every cron run to root, which is being redirected to dhoworth on the same machine and is delivered to his/my local mailbox on that machine (which I don't use). I actually want mail to root redirected to my real mail address, so I'll need to dig around in the configuration to discover what I did wrong.
Just put a forward rule on that user so that mail is forwarded where you want it. For this to work for outside addresses your machine has to have postfix correctly configured to be able to send system email to outside, ie, have a real world name. Otherwise, do somekind of cronjob that resends all that email with a script, placing a realworld "from" in your mail, and configure postfix appropriately, too. Or edit the run-crons script, which is easier - till updated.
The mail sent for the daily cron jobs includes the output from the cron.daily.local so at least I've found that. I now just need to arrange for that output to be produced even when I turn off the email logging for every cron run.
Notice that there is a difference between mail sent from crun jobs, and mails sent from those daily, monthly, etc, scripts. These are sent by the run-cruns scripts instead. - -- Cheers / Saludos, Carlos E. R. (from 11.2 x86_64 "Emerald" GM (Elessar)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAkwzA4EACgkQU92UU+smfQXz1ACgis3t2l9fB25kqt2o7+sp9ylk PzAAnRva64nGvN17wO5U6SgQhVTB0R5G =jqrS -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos E. R. wrote:
On 2010-07-06 11:36, Dave Howorth wrote:
Carlos E. R. wrote:
Check the mail log in any case to be sure. Doh! I don't know why I hadn't already done that (and thanks to Per for also suggesting it). It makes things a lot more clear! :)
cron is sending mail for every cron run to root, which is being redirected to dhoworth on the same machine and is delivered to his/my local mailbox on that machine (which I don't use). I actually want mail to root redirected to my real mail address, so I'll need to dig around in the configuration to discover what I did wrong.
Just put a forward rule on that user so that mail is forwarded where you want it. For this to work for outside addresses your machine has to have postfix correctly configured to be able to send system email to outside, ie, have a real world name.
Why not use /etc/aliases to define that user or mail address Togan
Carlos E. R. wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2010-07-06 11:36, Dave Howorth wrote:
Carlos E. R. wrote:
Check the mail log in any case to be sure. Doh! I don't know why I hadn't already done that (and thanks to Per for also suggesting it). It makes things a lot more clear! :)
cron is sending mail for every cron run to root, which is being redirected to dhoworth on the same machine and is delivered to his/my local mailbox on that machine (which I don't use). I actually want mail to root redirected to my real mail address, so I'll need to dig around in the configuration to discover what I did wrong.
Just put a forward rule on that user so that mail is forwarded where you want it. For this to work for outside addresses your machine has to have postfix correctly configured to be able to send system email to outside, ie, have a real world name.
I don't fully understand that (I've never played with postscript directly). But I went into Yast/Network Services/Mail server and there's a box there that sets the root mail redirection, so I've changed that from dhoworth to dhoworth@my-fqdn The machine is able to deliver mail externally. It already does it properly for 'normal' cronjobs with a MAILTO line. It's just cron.daily.local that has a problem.
Otherwise, do somekind of cronjob that resends all that email with a script, placing a realworld "from" in your mail, and configure postfix appropriately, too.
Or edit the run-crons script, which is easier - till updated.
Yes I've just rediscovered that. Looking at an older machine I see that that's what I did a few years ago. So I'll probably do that again.
The mail sent for the daily cron jobs includes the output from the cron.daily.local so at least I've found that. I now just need to arrange for that output to be produced even when I turn off the email logging for every cron run.
Notice that there is a difference between mail sent from crun jobs, and mails sent from those daily, monthly, etc, scripts. These are sent by the run-cruns scripts instead.
Yes. Irritating, isn't it! Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Carlos E. R.
-
Chuck Payne
-
Dave Howorth
-
Michael S. Dunsavage
-
Per Jessen
-
Togan Muftuoglu