Re: Silent Cron Jobs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 27 March 2008, Patter <[EMAIL PROTECTED]> was heard to say: > http://www.linuxhelp.net/guides/cron/ Thanks for all the help, everyone. Indeed, for this, redirecting stderr is just fine too, so "cmd > /dev/null 2>&1" is exactly what I need. Much obliged, Curt- - -- Treason! http://blog.mises.org/archives/007926.asp -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iQEVAwUBR+usoy9Y35yItIgBAQKWpwf+NZeG7PkuSakWdl3sIiQvbkNZoX7NkS7L RUX6KBbrISyYx5DSM+nPlEWRH+oTMvg6HnO6fq1Afdm9yLQRgHbCj+ppufRpx2u6 z5YY3x4RVbVvKkhcfIQYABvBJtMm+xtXq5sjVlWmyFvpSLdbz0joGfm8NEFQujNW kRFkj0waf6webZet6aybJ73w1XI5pXHLhhwUjCtj19u1QiBvq0cDcPTudiOlQc+q Pgr7RayrCnr0G+3gyqvuqJVdwsxWithcHywUL4GX5lUKbO9ArG5D/lL8d1bKjyaF 74TYhrmQQYyRbq4XKy8Ah3ORWAB994y34onoDrHAf7Hsxbjym/rsuQ== =DEv1 -END PGP SIGNATURE- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Silent Cron Jobs
On 3/26/08, Curt Howland <[EMAIL PROTECTED]> wrote: > I tried to whip up a small cron job, I put a short script > in /etc/cron.daily thinking that this would work. > > Well, yes, it works, but I get mail sent to me by cron explaining that > the job executed successfully. That's odd, usually cron only sends mail if the job failed or there was output. Is there output? Even if it's a single space or a blank line? > I'd prefer not to get the mail. I don't get mail for any of the other > jobs in cron.daily, and I don't understand enough of bash scripting > to see how mine is different from the others. You can always dump the output to /dev/null. In case you don't know: | command_here >/dev/null 2>&1 This has the disadvantage that legitimate messages may be discarded. Your call. Tom -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Silent Cron Jobs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Curt Howland wrote: | Hi. | | I tried to whip up a small cron job, I put a short script | in /etc/cron.daily thinking that this would work. | | Well, yes, it works, but I get mail sent to me by cron explaining that | the job executed successfully. | | I'd prefer not to get the mail. I don't get mail for any of the other | jobs in cron.daily, and I don't understand enough of bash scripting | to see how mine is different from the others. | | If all else fails I could just add a line to /etc/crontab, but I think | the Debian way is so very much better coordinated and elegant. | | Curt- | I send the output of such cron jobs to /dev/null. that is ~ > /dev/null 2>&1 - -- -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFH6tcsu4tRirKTPYwRAuOGAJ9g3Xc6fZWKzZy4o+pifO4KzilX0ACeMdE1 6UygOGX97U2j1twC9t2fkMk= =Tn4i -END PGP SIGNATURE- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Silent Cron Jobs
On Wed, 26 Mar 2008 20:40:12 +0100, Curt Howland wrote: > I tried to whip up a small cron job, I put a short script > in /etc/cron.daily thinking that this would work. > > Well, yes, it works, but I get mail sent to me by cron explaining that > the job executed successfully. http://www.linuxhelp.net/guides/cron/ -- Stephen Patterson :: [EMAIL PROTECTED] :: http://patter.mine.nu/ GPG: B416F0DE :: Jabber: [EMAIL PROTECTED] "Don't be silly, Minnie. Who'd be walking round these cliffs with a gas oven?" -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Silent Cron Jobs
On Wed, Mar 26, 2008 at 10:05 AM, Curt Howland <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi. > > I tried to whip up a small cron job, I put a short script > in /etc/cron.daily thinking that this would work. > > Well, yes, it works, but I get mail sent to me by cron explaining that > the job executed successfully. > > I'd prefer not to get the mail. I don't get mail for any of the other > jobs in cron.daily, and I don't understand enough of bash scripting > to see how mine is different from the others. >From the cron manpage: "When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists)." So, either suppress output with something like 'cmd >/dev/null 2>&1' or put 'MAILTO=""' in the script. I think :) Patrick -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Silent Cron Jobs
Hi, afaik cron (by default) mails all output from a script. If i create a cronjob I usually dump all stdout (just redirect it to /dev/null) But I want to be informed of any errors so I keep stderr. example: # this will get mailed echo "My cool cron script" # this will not mail stdout, but stderr (see below for an example) echo "My cooler cron script" > /dev/null # this will send you a mail because there was output on stderr, if there was output on stdout it wouldn't mail /nonexistant/echo "My failing cron script" > /dev/null Not this is untested and just a quick writeup but the general rule should apply hth martin On Wed, Mar 26, 2008 at 3:05 PM, Curt Howland <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi. > > I tried to whip up a small cron job, I put a short script > in /etc/cron.daily thinking that this would work. > > Well, yes, it works, but I get mail sent to me by cron explaining that > the job executed successfully. > > I'd prefer not to get the mail. I don't get mail for any of the other > jobs in cron.daily, and I don't understand enough of bash scripting > to see how mine is different from the others. > > If all else fails I could just add a line to /etc/crontab, but I think > the Debian way is so very much better coordinated and elegant. > > Curt- > > - -- > Treason! http://blog.mises.org/archives/007926.asp > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.6 (GNU/Linux) > > iQEVAwUBR+pYQi9Y35yItIgBAQJkcgf/c8y5Sbd4WkNChuA2muNkprTVFy6JkMIs > 8gHQReKiEJH6R4QHVTWRtElqjWHDcry15lCV6h2AIN5w+FIPKmvFcViA3rGk5jK3 > Jr/NzC3twwtRaxhvUKDNrfr0VHmAjHeVxBdBHt287zejzDc9TCECcPBderco82rO > OwmDs7WuNzQrWZSz8VDGFhjxdJrdhUIVzgeSamD0xtt65gNvUj6GN2YxGeUODlTk > V9XfO6vxsrK3chBrag7Cz4EA5pPsyK3QoMtr/NrCPSBPbE2dT38hZAtz3dIN4yq1 > ve2fmP7HMF24TtKhTKxkmKN6Qm3uOT8B9qiZ7VPrJsvldcSJVAHuAA== > =IgSr > -END PGP SIGNATURE- > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > -- http://tumblr.marcher.name https://twitter.com/MartinMarcher http://www.xing.com/profile/Martin_Marcher http://www.linkedin.com/in/martinmarcher You are not free to read this message, by doing so, you have violated my licence and are required to urinate publicly. Thank you. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Silent Cron Jobs
Hi, > > I tried to whip up a small cron job, I put a short script > in /etc/cron.daily thinking that this would work. > > Well, yes, it works, but I get mail sent to me by cron explaining that > the job executed successfully. > > I'd prefer not to get the mail. I don't get mail for any of the other > jobs in cron.daily, and I don't understand enough of bash scripting > to see how mine is different from the others. > > If all else fails I could just add a line to /etc/crontab, but I think > the Debian way is so very much better coordinated and elegant. just add this line at the beggining of your script : exec >/dev/null this will discard any standard output and should be enough (you only get a mail when your program produces some output). You can also discard stderr by adding 2>&1 at the end of this line, but this is not a good idea as you could miss some important error message. -- Cédric Lucantis
Re: Silent Cron Jobs
On Wed, Mar 26, 2008 at 10:05:53AM -0400, Curt Howland wrote: > Well, yes, it works, but I get mail sent to me by cron explaining that > the job executed successfully. > > I'd prefer not to get the mail. I don't get mail for any of the other > jobs in cron.daily, and I don't understand enough of bash scripting > to see how mine is different from the others. One way to do it is to add '> /dev/null 2>&1' to the crontab entry. Regards Johann -- Johann Spies Telefoon: 021-808 4036 Informasietegnologie, Universiteit van Stellenbosch "Casting all your care upon him; for he careth for you." I Peter 5:7 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]