rst@lucifer.UUCP ( 233) (04/10/91)
I am trying to get cron to mail me the standard output and standard error of regularly run commands. I have an entry that looks like this:- /usr/local/etc/crontab/evening |& mail -s "Evening cleanup" sysadmin I know the command is being executed, but the mail is never sent. Any ideas? Richard -- Richard Thombs Lucas Powertrain Systems, Mail: rst@eg.lucasauto.co.uk Phoenix Way, Phone: +44 285 657981 x233 Cirencester, GL7 1QG, Fax: +44 285 658258 (G3) England.
john@pta.oz.au (John Sims) (04/12/91)
In article <1031@lucifer.UUCP> rst@lucifer.UUCP ( 233) writes: >I am trying to get cron to mail me the standard output and standard error of >regularly run commands. I have an entry that looks like this:- > >/usr/local/etc/crontab/evening |& mail -s "Evening cleanup" sysadmin > >I know the command is being executed, but the mail is never sent. Any ideas? Assumption: you are talking about ucb cron, not att. Two things: Your command line uses csh syntax. cron only talks Bourne shell. cron tends to run with a fairly restricted path (ours runs with only /bin and /usr/bin), and /bin/mail (again, on our system) doesn't like -s. Try using the full pathname (probably /usr/ucb/mail). If this doesn't get you anywhere, let me know wither by posting or email. John. -- -m------- John Sims UUCP: pyramid!pta!john ---mmm----- Pyramid Technology Corporation INTERNET: john@pta.oz.au -----mmmmm--- 328 High Street VOICE: +61 2 415 0515 -------mmmmmmm- Chatswood 2057 Australia FAX: +61 2 417 8636
tr@samadams.princeton.edu (Tom Reingold) (04/16/91)
In article <1031@lucifer.UUCP> rst@lucifer.UUCP ( 233) writes:
$ I am trying to get cron to mail me the standard output and standard error of
$ regularly run commands. I have an entry that looks like this:-
$
$ /usr/local/etc/crontab/evening |& mail -s "Evening cleanup" sysadmin
$
$ I know the command is being executed, but the mail is never sent. Any ideas?
If you use the cron in the att universe, you will get this
automatically. Not only that, ordinary users can use cron in the att
universe. They must (and the superuser ought to) use the "crontab"
command for updating their personal crontab files.
Now if you still want to do it your way, try
command 2>&1 | mail -s "subject" sysadmin
This is Bourne shell syntax. The "2>&1" means send output destined for
file descriptor 2 to where output for fd 1 is going.
--
Tom Reingold
tr@samadams.princeton.edu OR ...!princeton!samadams!tr
"Warning: Do not drive with Auto-Shade in place. Remove
from windshield before starting ignition."
pdk@pyrnj.uucp (Paul Kramer) (04/16/91)
In article <1991Apr15.215936.27605@newross.Princeton.EDU> tr@samadams.princeton.edu (Tom Reingold) writes: >If you use the cron in the att universe, you will get this >automatically. Not only that, ordinary users can use cron in the att >universe. They must (and the superuser ought to) use the "crontab" >command for updating their personal crontab files. FYI: If the super user places an entry in the 'cron.allow' file for that user, they should be allowed to update entries in their own crontab file with impunity using the crontab(1) command. If this file does not exist, then they may still be allowed to use the crontab(1) command if their id does not appear in the 'cron.deny' file. cheers, paul davis kramer