Re: e-mail from cron

2006-08-24 Thread Lisa Casey

Hi All,

Thanks for all of your help. Creating /etc/periodic.conf  with the 
appropriate data did the trick. I appreciate it.


Lisa Casey

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread Bill Moran
In response to David King <[EMAIL PROTECTED]>:

> >> to this:
> >>
> >> # Perform daily/weekly/monthly maintenance.
> >> 1   3   *   *   *   rootperiodic daily   
> >> 2>&1 | sendmail [EMAIL PROTECTED]
> > [...]
> > However, you might find it easier to just add the following line to  
> > the
> > top of the crontab:
> > [EMAIL PROTECTED]
> > Which will cause all mail generated by the jobs in that file to be  
> > sent
> > to the provided address.
> 
> Is that true? MAILTO should change the destination of the output of  
> cron jobs, but periodic handles its own output

You're correct.  That's my mistake and I apologize for the misinformation.

Simply put, periodic does not generate any output to either stdout or
stderr.  It has its own system for determining who to mail to.  See
/etc/defaults/periodic.conf or appropriate man pages for the details.

-- 
Bill Moran
Collaborative Fusion Inc.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread David King

to this:

# Perform daily/weekly/monthly maintenance.
1   3   *   *   *   rootperiodic daily   
2>&1 | sendmail [EMAIL PROTECTED]

[...]
However, you might find it easier to just add the following line to  
the

top of the crontab:
[EMAIL PROTECTED]
Which will cause all mail generated by the jobs in that file to be  
sent

to the provided address.


Is that true? MAILTO should change the destination of the output of  
cron jobs, but periodic handles its own output

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread David King

30  5   1   *   *   rootperiodic monthly 2>&1
| sendmail [EMAIL PROTECTED]
but all I get is a blank email sent to [EMAIL PROTECTED]

[...]
also.. using 2>&1 doesn't seem appropriate, afaik you would use  
that in

crontab if you don't want to get emails via cron


You would use "2>&1" in conjunction with ">/dev/null" if you didn't  
want to get emails from cron, sure. But if you don't redirect stderr,  
then stderr doesn't end up in the mail.


That is, if "periodic monthly" outputs stdout and stderr, and you  
only redirect (with "|") stdout, then you don't get the stderr.  
"2>&1" says, "send output from file-descriptor 2 (stderr) to file- 
descriptor 1 (stdout)". That way the redirection with the pipe  
contains both stdout and stderr.


As far as redirecting the periodic output to a different user, set  
"daily_output" in /etc/periodic.conf. See /etc/defaults/periodic.conf  
for an example. You'd of course have to do the same for weekly and  
monthly.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread Bill Moran
In response to "Lisa Casey" <[EMAIL PROTECTED]>:

> to this:
> 
> # Perform daily/weekly/monthly maintenance.
> 1   3   *   *   *   rootperiodic daily  2>&1 | 
> sendmail [EMAIL PROTECTED]

This is a bad idea, mainly because (as you already know) it doesn't work :)

If you want to use that syntax above, use mail(1) instead of sendmail.

However, you might find it easier to just add the following line to the
top of the crontab:
[EMAIL PROTECTED]

Which will cause all mail generated by the jobs in that file to be sent
to the provided address.

-- 
Bill Moran
Collaborative Fusion Inc.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread Dan Nelson
In the last episode (Aug 23), Lisa Casey said:
> This ought to be a fairly simple question, but I've googled and can't
> really find the answer.
> 
> I'ld like to have the reports from the system cron jobs (daily run
> output, security run output, weekly run output and monthly run
> output) sent to an e-mail address other than root, but I want all the
> "postmaster" stuff (mailer-daemon emails, etc.) to continue going to
> root (so I don't particularly want to just forward root's mail
> somewhere using the aliases file).

The periodic scripts generate their own emails, so setting MAILTO= in
crontab (or manually piping the output to sendmail as you did) won't do
anything.  They default to the "root" email address, but you can change
it by editing /etc/periodic.conf and adding lines like

daily_output="[EMAIL PROTECTED]"

.  Use /etc/defaults/periodic.conf as a references.  This feature is
documented in the periodic(8) manpage, but all the examples log to
files, so it's easy to miss that fact that you can also use email
addresses.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread Alex Zbyslaw

Lisa Casey wrote:



# Perform daily/weekly/monthly maintenance.
1   3   *   *   *   rootperiodic daily  2>&1 | 
sendmail [EMAIL PROTECTED]
15  4   *   *   6   rootperiodic weekly 2>&1 | 
sendmail [EMAIL PROTECTED]
30  5   1   *   *   rootperiodic monthly 2>&1 
| sendmail [EMAIL PROTECTED]

#

If these were standard cronjobs sending output to stdout then this would 
work (though I would use e.g. "mail -s 'my subject'" not sendmail - 
latter only really useful when you want to generate the headers 
yourself).  However, IIRC, periodic jobs are handled differently.  
Extract from man periodic.conf:


dir_output
(path or list) What to do with the output of the scripts executed
from the directory dir.  If this variable is set to an absolute
path name, output is logged to that file, otherwise it is taken
as one or more space separated email addresses and mailed to
those users.  If this variable is not set or is empty, output is
sent to standard output.

e.g.
[EMAIL PROTECTED]

same for weekly, monthly.

Or unset all of them and use the crontab email method you used above.

--Alex


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: e-mail from cron

2006-08-23 Thread albi
On Wed, 23 Aug 2006 10:05:14 -0400
"Lisa Casey" <[EMAIL PROTECTED]> wrote:


> 30  5   1   *   *   rootperiodic monthly 2>&1
> | sendmail [EMAIL PROTECTED]
> #
> 
> but all I get is a blank email sent to [EMAIL PROTECTED]

does it work if you use the command "mail" instead ? see : man mail

also.. using 2>&1 doesn't seem appropriate, afaik you would use that in
crontab if you don't want to get emails via cron

-- 
grtjs,
albi
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


e-mail from cron

2006-08-23 Thread Lisa Casey

Hi,

This ought to be a fairly simple question, but I've googled and can't really 
find the answer.


I'ld like to have the reports from the system cron jobs (daily run output, 
security run output, weekly run output and monthly run output) sent to an 
e-mail address other than root, but I want all  the "postmaster" stuff 
(mailer-daemon emails, etc.) to continue going to root (so I don't 
particularly want to just forward root's mail somewhere using the aliases 
file).


In /etc/crontab, I changed this:

# Perform daily/weekly/monthly maintenance.
1   3   *   *   *   rootperiodic daily
15  4   *   *   6   rootperiodic weekly
30  5   1   *   *   rootperiodic monthly
#

to this:

# Perform daily/weekly/monthly maintenance.
1   3   *   *   *   rootperiodic daily  2>&1 | 
sendmail [EMAIL PROTECTED]
15  4   *   *   6   rootperiodic weekly 2>&1 | 
sendmail [EMAIL PROTECTED]
30  5   1   *   *   rootperiodic monthly 2>&1 | 
sendmail [EMAIL PROTECTED]

#

but all I get is a blank email sent to [EMAIL PROTECTED]

What's the best way to accomplish this?

Thanks,

Lisa Casey

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"