Re: Cron problems

2010-08-28 Thread Thomas Keusch
On Sat, Aug 28, 2010 at 01:49:18PM +0200, Bernt Hansson wrote:

Hell Bernt,

 I'm having problems with lines like this in cron, works on the command  
 line, but not in cron.

 /sbin/dump -0uan -f - /usr | gzip -2 | ssh -c blowfish \
 targetu...@targetmachine.example.com dd  
 of=/mybigfiles/dump-usr-l0-`date +%Y-%m-%d--%H-%M-%S`.gz

you need to escape the percent-signs like that: \%

For why see man 5 crontab

Regards
Thomas
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails (SOLVED)

2010-06-10 Thread Carlos Fernando Assis Paniago
I Had a terrible week with freebsd. In monday I did an upgrade from 7.3 
to 8.1-prerelease in 3 machines, 2 of them worked normaly and one stop 
functioning, and without user (ldap) e cron is not sending emails. The 
log for cron is:


Jun 10 19:45:00 sol /usr/sbin/cron[80892]: (root) CMD (/usr/libexec/atrun)
Jun 10 19:45:00 sol cron[80892]: NSSWITCH(_nsdispatch): ldap, group, 
setgrent, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80891]: NSSWITCH(_nsdispatch): ldap, group, 
setgrent, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80892]: NSSWITCH(_nsdispatch): ldap, group, 
getgrent_r, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80891]: NSSWITCH(_nsdispatch): ldap, group, 
getgrent_r, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80892]: NSSWITCH(_nsdispatch): ldap, group, 
endgrent, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80891]: NSSWITCH(_nsdispatch): ldap, group, 
endgrent, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80891]: NSSWITCH(_nsdispatch): ldap, passwd, 
endpwent, not found, and no fallback provided
Jun 10 19:45:00 sol cron[80892]: NSSWITCH(_nsdispatch): ldap, passwd, 
endpwent, not found, and no fallback provided



The ldap stop working with the messages:

Jun 10 17:25:09 sol slapd[41741]: @(#) $OpenLDAP: slapd 2.3.43 (Jun 10 
2010 17:16:31)
$   
r...@sol.cnptia.embrapa.br:/usr/ports/net/openldap23-server/work/openldap-2.3.43/servers/slapd
Jun 10 17:25:09 sol slapd[41741]: NSSWITCH(_nsdispatch): ldap, passwd, 
endpwent, not found, and no fallback provided
Jun 10 17:25:09 sol slapd[41741]: NSSWITCH(_nsdispatch): ldap, group, 
setgrent, not found, and no fallback provided
Jun 10 17:25:09 sol slapd[41741]: NSSWITCH(_nsdispatch): ldap, group, 
getgrent_r, not found, and no fallback provided
Jun 10 17:25:09 sol slapd[41741]: NSSWITCH(_nsdispatch): ldap, group, 
endgrent, not found, and no fallback provided
Jun 10 17:25:09 sol slapd[41741]: NSSWITCH(_nsdispatch): ldap, group, 
endgrent, not found, and no fallback provided

Jun 10 17:25:09 sol slapd[41742]: slapd starting

and in auth.log this log

Jun  7 19:22:17 sol login: pam_acct_mgmt(): error in service module


And until today after recompiling everithing from the ports to the 
system I cannot find the error.


Today I found this:

rigel# ldd  /usr/local/lib/nss_ldap.so.1
/usr/local/lib/nss_ldap.so.1:
libldap-2.3.so.2 = /usr/local/lib/libldap-2.3.so.2 (0x800c0)
liblber-2.3.so.2 = /usr/local/lib/liblber-2.3.so.2 (0x800d37000)
libsasl2.so.2 = /usr/local/lib/libsasl2.so.2 (0x800e45000)
libkrb5.so.10 = /usr/lib/libkrb5.so.10 (0x800f5d000)
libcom_err.so.5 = /usr/lib/libcom_err.so.5 (0x8010ca000)
libgssapi_krb5.so.10 = /usr/lib/libgssapi_krb5.so.10 (0x8011cc000)
libc.so.6 =(unknow)
libssl.so.6 = /usr/lib/libssl.so.6 (0x8012e6000)
libcrypto.so.6 = /lib/libcrypto.so.6 (0x801438000)
libgssapi.so.10 = /usr/lib/libgssapi.so.10 (0x8016d2000)
libhx509.so.10 = /usr/lib/libhx509.so.10 (0x8017db000)
libroken.so.10 = /usr/lib/libroken.so.10 (0x80191a000)
libasn1.so.10 = /usr/lib/libasn1.so.10 (0x801a2b000)
libcrypt.so.5 = /lib/libcrypt.so.5 (0x801baa000)

The problem was the libsasl2 (cyrus-sasl2) that was old. I found a lot 
of pages in google with this problem and no solution.
And I find it using the command cd /usr/local/lib ; grep -R libc.so.6 
*. After the finding I compiled the module (cyrus-sals2) and everything 
comes back to normal.


The problem is that nss_ldap.so.1 dont say that the library is missing 
but point the error to the PAM modules.


Everyone that have this same problem try to find in the nss_ldap, 
pam_ldap etc, some reference to old libs.


Paniago
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-06-01 Thread Laszlo Nagy


  

Cron is still not sending emails. Any idea?



Is there any output in the 'maillog' log?
  


May 14 10:53:00 server postfix/sendmail[2958]: fatal: user(1001): No recipient 
addresses found in message header


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-06-01 Thread Laszlo Nagy


It doesn't work. With, or without the MAILTO.  Just for completeness, 
I have used this:


MAILTO=gandalf

The gandalf user is a local user on the system. I can send local 
mail to this user using the sendmail postfix program (checked twice).
  

Cron is still not sending emails. Any idea?



Yes, check the log of cron (/var/log/cron) if you job is run at all; if
so check the log of mails (/var/log/maillog).
  
Cron jobs are started. Just their output are not sent in emails. The 
output of the maillog I already sent before:


May 14 10:53:00 server postfix/sendmail[2958]: fatal: user(1001): No recipient 
addresses found in message header



Btw: what is the purpose of putting TEST into ?
  
I tend to use double quotes for command line parameters. This is just a 
habit that I use it even when it is not really necessary.



Output from /var/log/cron follows




Jun  1 04:55:00 shopzeus /usr/sbin/cron[89378]: (tmp.27734) ORPHAN (no 
passwd entry)

Jun  1 04:55:00 shopzeus /usr/sbin/cron[89378]: (root) RELOAD (tabs/root)
Jun  1 04:55:00 shopzeus /usr/sbin/cron[89378]: NSSWITCH(_nsdispatch): 
nis, passwd_compat, endpwent, not found, and no fallback provided
Jun  1 04:55:00 shopzeus /usr/sbin/cron[27073]: (operator) CMD 
(/usr/libexec/save-entropy)
Jun  1 04:55:00 shopzeus /usr/sbin/cron[27075]: (root) CMD 
(/usr/libexec/atrun)
Jun  1 04:55:00 shopzeus cron[27075]: NSSWITCH(_nsdispatch): nis, 
passwd_compat, endpwent, not found, and no fallback provided

Jun  1 04:55:00 shopzeus /usr/sbin/cron[27082]: (root) CMD (echo Test)

(Followed by other similar rows with NSSWITCH and CMD.)

Thanks

  Laszlo


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-06-01 Thread APseudoUtopia
2010/5/28 Laszlo Nagy gand...@shopzeus.com:
 Hi All!

 After upgrading to 8.0 RELEASE, I'm not getting any emails from cron.

 If I put this into root's crontab

 * * * * * echo TEST

 then I see this in the maillog:

 May 14 10:53:00 server postfix/sendmail[2958]: fatal: user(1001): No
 recipient addresses found in message header



Just as a side note, I started having this problem a while ago with
7.2-RELEASE, I believe. I was using the base-system sendmail and no
special configuration with cron or anything.

I never found a solution. I posted on this mailing list and nothing
anyone suggested solved it. I ended up just piping every single cron
command into /usr/bin/mail:

0  */4  *  *  *  root  /usr/local/backups/daily_backup.sh |
/usr/bin/mail -E -s Daily Backup em...@address.tld

That works fine.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-06-01 Thread Matthias Apitz
El día Tuesday, June 01, 2010 a las 09:41:11AM -0400, APseudoUtopia escribió:

 2010/5/28 Laszlo Nagy gand...@shopzeus.com:
  Hi All!
 
  After upgrading to 8.0 RELEASE, I'm not getting any emails from cron.
 
  If I put this into root's crontab
 
  * * * * * echo TEST
 
  then I see this in the maillog:
 
  May 14 10:53:00 server postfix/sendmail[2958]: fatal: user(1001): No
  recipient addresses found in message header
 
 
 
 Just as a side note, I started having this problem a while ago with
 7.2-RELEASE, I believe. I was using the base-system sendmail and no
 special configuration with cron or anything.
 
 I never found a solution. I posted on this mailing list and nothing
 anyone suggested solved it. I ended up just piping every single cron
 command into /usr/bin/mail:
 
 0  */4  *  *  *  root  /usr/local/backups/daily_backup.sh |
 /usr/bin/mail -E -s Daily Backup em...@address.tld
 
 That works fine.

current# uname -a
FreeBSD current.unixarea.de 8.0-CURRENT FreeBSD 8.0-CURRENT #5: Sun Jan 10 
09:55:14 CET 2010 g...@current.unixarea.de:/usr/obj/usr/src/sys/GENERIC i386

current# crontab -l | fgrep 15
56 15 * * *   /usr/sbin/ntpdate -b ntps1-0.cs.tu-berlin.de

current# tail -3 /var/log/cron
Jun  1 15:56:00 current /usr/sbin/cron[1509]: (root) RELOAD (tabs/root)
Jun  1 15:56:00 current /usr/sbin/cron[8209]: (root) CMD (/usr/sbin/ntpdate -b 
ntps1-0.cs.tu-berlin.de)
Jun  1 15:57:17 current crontab[8220]: (root) LIST (root)

current# tail /var/log/maillog
Jun  1 15:56:01 current sm-mta[8213]: o51Du1q1008212: 
to=r...@current.unixarea.de, ctladdr=r...@current.unixarea.de (0/0), 
delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30877, relay=local, 
dsn=2.0.0, stat=Sent

i.e. no problem on my system;

matthias
-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
Solidarity with the zionistic pirates of Israel?   Not in my  name!
¿Solidaridad con los piratas sionistas de Israel? ¡No en mi nombre!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-30 Thread Laszlo Nagy

If I put this into root's crontab


* * * * * echo TEST


a quick guess, you have a line like:
MAILTO=address

It doesn't work. With, or without the MAILTO.  Just for completeness, 
I have used this:


MAILTO=gandalf

The gandalf user is a local user on the system. I can send local 
mail to this user using the sendmail postfix program (checked twice).

Cron is still not sending emails. Any idea?

Thanks

   Laszlo

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-30 Thread Jerry
On Sun, 30 May 2010 17:21:20 +0200
Laszlo Nagy gand...@shopzeus.com articulated:


 Cron is still not sending emails. Any idea?

Is there any output in the 'maillog' log?


-- 
Jerry
freebsd.u...@seibercom.net

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-30 Thread Matthias Apitz
El día Sunday, May 30, 2010 a las 05:21:20PM +0200, Laszlo Nagy escribió:

 If I put this into root's crontab
 
 * * * * * echo TEST
 
 a quick guess, you have a line like:
 MAILTO=address
 
 It doesn't work. With, or without the MAILTO.  Just for completeness, 
 I have used this:
 
 MAILTO=gandalf
 
 The gandalf user is a local user on the system. I can send local 
 mail to this user using the sendmail postfix program (checked twice).
 Cron is still not sending emails. Any idea?

Yes, check the log of cron (/var/log/cron) if you job is run at all; if
so check the log of mails (/var/log/maillog).

Btw: what is the purpose of putting TEST into ?

matthias
-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
¡Ya basta! ¡Tropas de OTAN, fuera de Afghanistan!
There's an end of it! NATO troups out of Afghanistan!
Schluss jetzt endlich! NATO raus aus Afghanistan!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-28 Thread Chuck Swiger
Hi--

On May 28, 2010, at 4:42 AM, Laszlo Nagy wrote:
 If I put this into root's crontab
 
 * * * * * echo TEST
 
 then I see this in the maillog:
 
 May 14 10:53:00 server postfix/sendmail[2958]: fatal: user(1001): No 
 recipient addresses found in message header

These do not correspond.  It seems to think that the crontab is for uid 1001, 
but it can't seem to lookup a passwd entry for that uid:

 log_it: (tmp.27734 92380) ORPHAN (no passwd entry)

-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-28 Thread Laszlo Nagy

Chuck Swiger írta:

Hi--

On May 28, 2010, at 4:42 AM, Laszlo Nagy wrote:
  

If I put this into root's crontab

* * * * * echo TEST

then I see this in the maillog:

May 14 10:53:00 server postfix/sendmail[2958]: fatal: user(1001): No recipient 
addresses found in message header



These do not correspond.  
I can assure you, that the maillog DOES correspond to the cron job. E.g. 
if I add two jobs for the same point in time, then two new lines will 
appear in the maillog, at exactly the given time. If I remove them, then 
no line will show up etc.




It seems to think that the crontab is for uid 1001, but it can't seem to lookup 
a passwd entry for that uid:

  

log_it: (tmp.27734 92380) ORPHAN (no passwd entry)



  
Well, actually it is not just user=1001. Many users have crontabs on 
this system. I cannot tell which one is orphaned. (Maybe munin? That was 
removed recently from the system...) Actually, user 1001 does have a 
password entry. So do others, and their crontabs are working. Programs 
are started by cron, but their output is lost.


L

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-28 Thread Matthias Fechner

Am 28.05.10 13:42, schrieb Laszlo Nagy:

If I put this into root's crontab

* * * * * echo TEST


a quick guess, you have a line like:
MAILTO=address

Bye,
Matthias

--
Programming today is a race between software engineers striving to build bigger and 
better idiot-proof programs, and the universe trying to produce bigger and better idiots. 
So far, the universe is winning. -- Rich Cook

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron not sending emails

2010-05-28 Thread Laszlo Nagy

Matthias Fechner írta:

Am 28.05.10 13:42, schrieb Laszlo Nagy:

If I put this into root's crontab

* * * * * echo TEST


a quick guess, you have a line like:
MAILTO=address

Bye,
Matthias

It doesn't work. With, or without the MAILTO.  Just for completeness, I 
have used this:


MAILTO=gandalf

The gandalf user is a local user on the system. I can send local mail 
to this user using the sendmail postfix program (checked twice).


Best,

  Laszlo

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron mail problem solved

2009-06-15 Thread Frank Shute
On Mon, Jun 15, 2009 at 11:11:14AM +0200, DA Forsyth wrote:

 Why do I become so clever AFTER asking for help?
 
 Anyhow, I have solved the cron not sending email problem.
 The cron log file contains lines like this
 NSSWITCH(nss_method_lookup): nis, group_compat, setgrent, not found
 which when searched for produces the page at
 http://www.ivorde.ro/FreeBSD_Cron__NSSWITCH_nss_method_lookup_errors-
 44.html
 
 So I have edited my /etc/nsswitch.conf to have 
 group: files
 password: files
 (instead of 'compat')
 
 and now it works again.
 
 I guess I must have installed that file in the  upgrade during my 
 glazed mergemaster phase of 'esc i enter' to install all those files 
 whose only difference is the $Id$ tag (why do they bother?)

You can get mergemaster to ignore those cvs tags. In
/etc/mergemaster.rc:

DIFF_FLAG='-Bub'
DIFF_OPTIONS='-I$FreeBSD:.*[$]'
IGNORE_FILES='/etc/motd /etc/mail/mailer.conf /etc/printcap'

The 2nd line above tells diff to ignore lines that match that RE.


Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: cron mail problem solved

2009-06-15 Thread Tim Judd
On 6/15/09, DA Forsyth d.fors...@ru.ac.za wrote:
 Why do I become so clever AFTER asking for help?

 Anyhow, I have solved the cron not sending email problem.
 The cron log file contains lines like this
 NSSWITCH(nss_method_lookup): nis, group_compat, setgrent, not found
 which when searched for produces the page at
 http://www.ivorde.ro/FreeBSD_Cron__NSSWITCH_nss_method_lookup_errors-
 44.html

 So I have edited my /etc/nsswitch.conf to have
 group: files
 password: files
 (instead of 'compat')

 and now it works again.

 I guess I must have installed that file in the  upgrade during my
 glazed mergemaster phase of 'esc i enter' to install all those files
 whose only difference is the $Id$ tag (why do they bother?)



mergemaster(8)
-F

Lots of options, maybe check it out.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-10 Thread APseudoUtopia
On Wed, Mar 4, 2009 at 11:38 AM, Morgan Wesström
freebsd-questi...@pp.dyndns.biz wrote:
 Yeah, I am aware what dnl does. The reason I commented that stuff
 out is because I have no use for any of it - all those files (access,
 local-host-names, mailertable, virtusertable, etc) are all empty by
 default and I had no reason to add anything to them.  I'll try going
 back to the default config and putting the RELAY line in the access
 file.

 Thanks once again for the help. I really do appreciate the time.

 Sendmail is not an open relay by default so you need at least one RELAY
 entry in /etc/mail/access for it to forward mail externally. I'm still
 curious of where it picks up that w...@localhost but chances are it will
 disappear as soon as you have a valid access config.
 /Morgan
 ___

I still can't figure this whole issue out. I've tried everything
suggested in this thread, including reverting back to the default
sendmail config files.

I created a work-around by just piping all my crontabs into
/usr/bin/mail and sending output using that method. It doesn't solve
it, but it works for now.

Thanks for all the help.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-04 Thread Morgan Wesström
APseudoUtopia wrote:
 In my case I only see either local there or my smart host as defined
 in /var/mail/{hostname}.mc
 Can you provide a diff -u between /etc/mail/freebsd.mc and
 /etc/mail/{hostname}.mc ?

 /Morgan
 
 I'd switch over to postfix, but I'm only using this to send output
 from cron and the daily security run scripts. I don't receive any mail
 over the network, so I think it'd be pointless to go through the
 effort of switching and configuring another MTA.
 
 Here's the diff. I figured it was too long to include in the email
 (word wrap will make it hard to read :-P)
 http://pastebin.ca/1352338
 


I'm no expert on Sendmail but you are aware that dnl is Sendmail's way
of commenting out a line, aren't you? In your config you have disabled
pretty much every configuration file in /etc/mail, especially
/etc/mail/access which defines who can relay mail through the local MTA.
I'm pretty sure this isn't a good idea. Apart from this I couldn't see
any major differences between your config and FreeBSD's default. Why not
try to use the default config and make sure to populate /etc/mail/access
with at least 127.0.0.1 RELAY and try again?
/Morgan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-04 Thread APseudoUtopia
On Wed, Mar 4, 2009 at 5:36 AM, Morgan Wesström
freebsd-questi...@pp.dyndns.biz wrote:
 APseudoUtopia wrote:
 In my case I only see either local there or my smart host as defined
 in /var/mail/{hostname}.mc
 Can you provide a diff -u between /etc/mail/freebsd.mc and
 /etc/mail/{hostname}.mc ?

 /Morgan

 I'd switch over to postfix, but I'm only using this to send output
 from cron and the daily security run scripts. I don't receive any mail
 over the network, so I think it'd be pointless to go through the
 effort of switching and configuring another MTA.

 Here's the diff. I figured it was too long to include in the email
 (word wrap will make it hard to read :-P)
 http://pastebin.ca/1352338



 I'm no expert on Sendmail but you are aware that dnl is Sendmail's way
 of commenting out a line, aren't you? In your config you have disabled
 pretty much every configuration file in /etc/mail, especially
 /etc/mail/access which defines who can relay mail through the local MTA.
 I'm pretty sure this isn't a good idea. Apart from this I couldn't see
 any major differences between your config and FreeBSD's default. Why not
 try to use the default config and make sure to populate /etc/mail/access
 with at least 127.0.0.1 RELAY and try again?
 /Morgan

Yeah, I am aware what dnl does. The reason I commented that stuff
out is because I have no use for any of it - all those files (access,
local-host-names, mailertable, virtusertable, etc) are all empty by
default and I had no reason to add anything to them.  I'll try going
back to the default config and putting the RELAY line in the access
file.

Thanks once again for the help. I really do appreciate the time.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-04 Thread Morgan Wesström
 Yeah, I am aware what dnl does. The reason I commented that stuff
 out is because I have no use for any of it - all those files (access,
 local-host-names, mailertable, virtusertable, etc) are all empty by
 default and I had no reason to add anything to them.  I'll try going
 back to the default config and putting the RELAY line in the access
 file.
 
 Thanks once again for the help. I really do appreciate the time.

Sendmail is not an open relay by default so you need at least one RELAY
entry in /etc/mail/access for it to forward mail externally. I'm still
curious of where it picks up that w...@localhost but chances are it will
disappear as soon as you have a valid access config.
/Morgan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread APseudoUtopia
On Mon, Mar 2, 2009 at 10:14 PM, Glen Barber glen.j.bar...@gmail.com wrote:
 On Sun, Mar 1, 2009 at 2:24 PM, APseudoUtopia apseudouto...@gmail.com wrote:
 [snip]

 #
 # User www's crontab
 # Note, I also tried removing the MAILTO to no avail
 #
 MAILTO=root
 # m     h       dom     mon     dow     cmd
 *       *       *       *       *       echo Hello


 [snip]

 1.)  You are not using the full path to /bin/echo, which is why it is failing.

 2.) This is a poor designed way to test cron's mail output.

 A Better(tm) way would be something like:
 MAILTO=root
 */5 * * * * /bin/ping -c1 localhost /dev/null

 which would mail to root on success or failure.

 Regards,

 --
 Glen Barber


Thanks for the tips. I've put the following line in my normal user
account's crontab (This account does have a shell, it's one I use on a
daily basis):

SHELL=/bin/sh
mailto=my_email_acco...@gmail.com
*   *   *   *   *   /sbin/ping -c4 localhost

I'm getting no emails at all. In /var/log/maillog, I'm getting the
following output:

Mar  3 21:10:00 domain sendmail[86797]: n23LA0td086797: from=www,
size=0, class=0, nrcpts=0,
msgid=200903032110.n23la0td086...@subdomain.domain.tld,
relay=...@localhost
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread Glen Barber
On Tue, Mar 3, 2009 at 4:10 PM, APseudoUtopia apseudouto...@gmail.com wrote:
 Thanks for the tips. I've put the following line in my normal user
 account's crontab (This account does have a shell, it's one I use on a
 daily basis):

 SHELL=/bin/sh
 mailto=my_email_acco...@gmail.com
 *       *       *       *       *       /sbin/ping -c4 localhost

 I'm getting no emails at all. In /var/log/maillog, I'm getting the
 following output:

 Mar  3 21:10:00 domain sendmail[86797]: n23LA0td086797: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903032110.n23la0td086...@subdomain.domain.tld,
 relay=...@localhost


You've replaced a problem with another problem.  Have you tried to
send the mail locally first?

-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread Morgan Wesström

Glen Barber wrote:
 On Tue, Mar 3, 2009 at 4:10 PM, APseudoUtopia apseudouto...@gmail.com wrote:
 Thanks for the tips. I've put the following line in my normal user
 account's crontab (This account does have a shell, it's one I use on a
 daily basis):

 SHELL=/bin/sh
 mailto=my_email_acco...@gmail.com
 *   *   *   *   *   /sbin/ping -c4 localhost

 I'm getting no emails at all. In /var/log/maillog, I'm getting the
 following output:

 Mar  3 21:10:00 domain sendmail[86797]: n23LA0td086797: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903032110.n23la0td086...@subdomain.domain.tld,
 relay=...@localhost

Isn't w...@localhost a very weird hostname for a relay? Can you really
resolve that into an IP address?
/Morgan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread APseudoUtopia
On Tue, Mar 3, 2009 at 4:17 PM, Glen Barber glen.j.bar...@gmail.com wrote:
 On Tue, Mar 3, 2009 at 4:10 PM, APseudoUtopia apseudouto...@gmail.com wrote:
 Thanks for the tips. I've put the following line in my normal user
 account's crontab (This account does have a shell, it's one I use on a
 daily basis):

 SHELL=/bin/sh
 mailto=my_email_acco...@gmail.com
 *       *       *       *       *       /sbin/ping -c4 localhost

 I'm getting no emails at all. In /var/log/maillog, I'm getting the
 following output:

 Mar  3 21:10:00 domain sendmail[86797]: n23LA0td086797: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903032110.n23la0td086...@subdomain.domain.tld,
 relay=...@localhost


 You've replaced a problem with another problem.  Have you tried to
 send the mail locally first?

 --
 Glen Barber


I have tested it - and sending mail manually from command line to the
gmail account works fine without any problems.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread APseudoUtopia
On Tue, Mar 3, 2009 at 4:52 PM, Morgan Wesström
freebsd-questi...@pp.dyndns.biz wrote:

 Glen Barber wrote:
 On Tue, Mar 3, 2009 at 4:10 PM, APseudoUtopia apseudouto...@gmail.com 
 wrote:
 Thanks for the tips. I've put the following line in my normal user
 account's crontab (This account does have a shell, it's one I use on a
 daily basis):

 SHELL=/bin/sh
 mailto=my_email_acco...@gmail.com
 *       *       *       *       *       /sbin/ping -c4 localhost

 I'm getting no emails at all. In /var/log/maillog, I'm getting the
 following output:

 Mar  3 21:10:00 domain sendmail[86797]: n23LA0td086797: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903032110.n23la0td086...@subdomain.domain.tld,
 relay=...@localhost

 Isn't w...@localhost a very weird hostname for a relay? Can you really
 resolve that into an IP address?
 /Morgan

Hm, I'm not sure where it's getting that from. The MAILTO variable is
set in the crontab, so it shouldn't be going to or relaying through
localhost at all, right? It should go directly to gmail's servers?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread Glen Barber
On Tue, Mar 3, 2009 at 5:29 PM, APseudoUtopia apseudouto...@gmail.com wrote:

 I have tested it - and sending mail manually from command line to the
 gmail account works fine without any problems.


What I'm saying is that you changed two of the variables without
actually verifying one or the other work first.  Change the MAILTO
back to root and retest.


-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread APseudoUtopia
On Tue, Mar 3, 2009 at 5:44 PM, Glen Barber glen.j.bar...@gmail.com wrote:
 On Tue, Mar 3, 2009 at 5:29 PM, APseudoUtopia apseudouto...@gmail.com wrote:

 I have tested it - and sending mail manually from command line to the
 gmail account works fine without any problems.


 What I'm saying is that you changed two of the variables without
 actually verifying one or the other work first.  Change the MAILTO
 back to root and retest.


 --
 Glen Barber


SHELL=/bin/sh
#mailto=st...@tastetherainbow.ws
MAILTO=root
*   *   *   *   *   /sbin/ping -c4 localhost

Still no email. Same message in the maillog:

Mar  3 22:48:00 youcant sendmail[92113]: n23Mm0vP092113: from=www,
size=0, class=0, nrcpts=0,
msgid=200903032248.n23mm0vp092...@youcant.tastetherainbow.ws,
relay=...@localhost

This is driving me crazy :-\
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread Mel
On Tuesday 03 March 2009 13:44:34 APseudoUtopia wrote:
 On Tue, Mar 3, 2009 at 4:52 PM, Morgan Wesström

 freebsd-questi...@pp.dyndns.biz wrote:
  Glen Barber wrote:
  On Tue, Mar 3, 2009 at 4:10 PM, APseudoUtopia apseudouto...@gmail.com 
wrote:
  Thanks for the tips. I've put the following line in my normal user
  account's crontab (This account does have a shell, it's one I use on a
  daily basis):
 
  SHELL=/bin/sh
  mailto=my_email_acco...@gmail.com
  *       *       *       *       *       /sbin/ping -c4 localhost
 
  I'm getting no emails at all. In /var/log/maillog, I'm getting the
  following output:
 
  Mar  3 21:10:00 domain sendmail[86797]: n23LA0td086797: from=www,
  size=0, class=0, nrcpts=0,
  msgid=200903032110.n23la0td086...@subdomain.domain.tld,
  relay=...@localhost
 
  Isn't w...@localhost a very weird hostname for a relay? Can you really
  resolve that into an IP address?
  /Morgan

 Hm, I'm not sure where it's getting that from. The MAILTO variable is
 set in the crontab, so it shouldn't be going to or relaying through
 localhost at all, right? It should go directly to gmail's servers?

If grep 'n23LA0td086797' /var/log/maillog only yields one entry, then 
something is wrong with your email setup. There should at least be one more 
entry from the spooler to pickup final destination. And yes, the 
relay 'w...@localhost' seems odd, but since I gave up sendmail for postfix 
years ago, I'm not current with how it spits things into syslog.

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread Morgan Wesström
 relay=...@localhost
 Isn't w...@localhost a very weird hostname for a relay? Can you really
 resolve that into an IP address?
 /Morgan
 Hm, I'm not sure where it's getting that from. The MAILTO variable is
 set in the crontab, so it shouldn't be going to or relaying through
 localhost at all, right? It should go directly to gmail's servers?
 
 If grep 'n23LA0td086797' /var/log/maillog only yields one entry, then 
 something is wrong with your email setup. There should at least be one more 
 entry from the spooler to pickup final destination. And yes, the 
 relay 'w...@localhost' seems odd, but since I gave up sendmail for postfix 
 years ago, I'm not current with how it spits things into syslog.
 

In my case I only see either local there or my smart host as defined
in /var/mail/{hostname}.mc
Can you provide a diff -u between /etc/mail/freebsd.mc and
/etc/mail/{hostname}.mc ?

/Morgan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-03 Thread APseudoUtopia
On Tue, Mar 3, 2009 at 6:48 PM, Morgan Wesström
freebsd-questi...@pp.dyndns.biz wrote:
 relay=...@localhost
 Isn't w...@localhost a very weird hostname for a relay? Can you really
 resolve that into an IP address?
 /Morgan
 Hm, I'm not sure where it's getting that from. The MAILTO variable is
 set in the crontab, so it shouldn't be going to or relaying through
 localhost at all, right? It should go directly to gmail's servers?

 If grep 'n23LA0td086797' /var/log/maillog only yields one entry, then
 something is wrong with your email setup. There should at least be one more
 entry from the spooler to pickup final destination. And yes, the
 relay 'w...@localhost' seems odd, but since I gave up sendmail for postfix
 years ago, I'm not current with how it spits things into syslog.


 In my case I only see either local there or my smart host as defined
 in /var/mail/{hostname}.mc
 Can you provide a diff -u between /etc/mail/freebsd.mc and
 /etc/mail/{hostname}.mc ?

 /Morgan

I'd switch over to postfix, but I'm only using this to send output
from cron and the daily security run scripts. I don't receive any mail
over the network, so I think it'd be pointless to go through the
effort of switching and configuring another MTA.

Here's the diff. I figured it was too long to include in the email
(word wrap will make it hard to read :-P)
http://pastebin.ca/1352338

Here's the full contents of /etc/mail/{hostname}.mc
http://pastebin.ca/1352340

Thanks for the help.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-02 Thread APseudoUtopia
On Sun, Mar 1, 2009 at 9:03 PM, Frank Shute fr...@shute.org.uk wrote:
 On Sun, Mar 01, 2009 at 02:24:47PM -0500, APseudoUtopia wrote:

 Cron is not sending output as emails. I noticed this when I stopped
 seeing the output of a backup script in my daily email. I thought
 there was a problem with the backup script - but no, it's cron not
 sending the emails.

 I had this problem before on 6.1, which I never found a solution to. I
 gave up on it, and eventually I upgraded to 7.1. After the upgrade,
 cron worked perfectly. However, I just noticed that it stopped working
 again. I have no idea what changed (It's a production server, I
 haven't been playing with config files).

 User www's mail is redirected to root, which is redirected to a @gmail
 account via /etc/aliases.
 This is on 7.1-RELEASE-p3 running a custom kernel.

 Any solution to this problem would be fantastic. I use the emails from
 cron on a daily basis, and it really messes me up to have it not
 working.

 #
 # User www's crontab
 # Note, I also tried removing the MAILTO to no avail
 #
 MAILTO=root
 # m     h       dom     mon     dow     cmd
 *       *       *       *       *       echo Hello


 
 # /var/log/cron
 
 Mar  1 19:22:00 youcant /usr/sbin/cron[22627]: (operator) CMD
 (/usr/libexec/save-entropy)
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 Mar  1 19:22:00 youcant /usr/sbin/cron[22628]: (www) CMD (echo Hello)
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found



 
 # /var/log/maillog
 
 Mar  1 19:22:00 youcant sendmail[22630]: n21JM0Gl022630: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903011922.n21jm0gl022...@youcant.tastetherainbow.ws,
 relay=...@localhost

 It looks like you're using user: www for your crontab.

 Unfortunately, from /etc/passwd:

 www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin

 i.e user www can't do much without a shell.

 Create a crontab as a user with a shell, MAILTO to your gmail account.

 The user may want to be a member of a group with privileges. Or use
 sudo.

 Don't forget to add him to /var/cron/allow as per manpage for
 crontab(1).

 You could set SHELL in your crontab for www (might work) but I'd use a
 different user who's a member of group operator maybe.

 Hope that helps.

 Regards,

 --

  Frank


  Contact info: http://www.shute.org.uk/misc/contact.html



Thanks for the suggestions. The backup script I have in the crontab
still runs perfectly fine - there's just no output. So cron itself is
working, just not any email output. I'll try playing around with the
MAILTO and the SHELL and such to try and get it working.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-02 Thread Frank Shute
On Sun, Mar 01, 2009 at 02:24:47PM -0500, APseudoUtopia wrote:

 Cron is not sending output as emails. I noticed this when I stopped
 seeing the output of a backup script in my daily email. I thought
 there was a problem with the backup script - but no, it's cron not
 sending the emails.
 
 I had this problem before on 6.1, which I never found a solution to. I
 gave up on it, and eventually I upgraded to 7.1. After the upgrade,
 cron worked perfectly. However, I just noticed that it stopped working
 again. I have no idea what changed (It's a production server, I
 haven't been playing with config files).
 
 User www's mail is redirected to root, which is redirected to a @gmail
 account via /etc/aliases.
 This is on 7.1-RELEASE-p3 running a custom kernel.
 
 Any solution to this problem would be fantastic. I use the emails from
 cron on a daily basis, and it really messes me up to have it not
 working.
 
 #
 # User www's crontab
 # Note, I also tried removing the MAILTO to no avail
 #
 MAILTO=root
 # m h   dom mon dow cmd
 *   *   *   *   *   echo Hello

PATH is not set or binary not called with it's path.

 
 
 
 # /var/log/cron
 
 Mar  1 19:22:00 youcant /usr/sbin/cron[22627]: (operator) CMD
 (/usr/libexec/save-entropy)
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 Mar  1 19:22:00 youcant /usr/sbin/cron[22628]: (www) CMD (echo Hello)
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 
 
Heh! I misread your original post. I didn't  realise that youcant
was your hostname. It confused me ;)

A few ideas: Make MAILTO in cron point to your gmail account. If not
you'll need an alias for www in aliases(5) to point to that gmail
account and you have to remember to rebuild it with newaliases(1)
after you've edited it.

 
 
 # /var/log/maillog
 
 Mar  1 19:22:00 youcant sendmail[22630]: n21JM0Gl022630: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903011922.n21jm0gl022...@youcant.tastetherainbow.ws,
 relay=...@localhost

This has got a few problems. It's saying the size of the message is 0
(probably because you've not set your PATH)  the number of recipients
is 0 and it seems to be relaying it to w...@localhost rather than
delivering it to your gmail account (newaliases not run).

Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-02 Thread Glen Barber
On Sun, Mar 1, 2009 at 2:24 PM, APseudoUtopia apseudouto...@gmail.com wrote:
[snip]

 #
 # User www's crontab
 # Note, I also tried removing the MAILTO to no avail
 #
 MAILTO=root
 # m     h       dom     mon     dow     cmd
 *       *       *       *       *       echo Hello


[snip]

1.)  You are not using the full path to /bin/echo, which is why it is failing.

2.) This is a poor designed way to test cron's mail output.

A Better(tm) way would be something like:
MAILTO=root
*/5 * * * * /bin/ping -c1 localhost /dev/null

which would mail to root on success or failure.

Regards,

-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Not Sending Mail

2009-03-01 Thread Frank Shute
On Sun, Mar 01, 2009 at 02:24:47PM -0500, APseudoUtopia wrote:

 Cron is not sending output as emails. I noticed this when I stopped
 seeing the output of a backup script in my daily email. I thought
 there was a problem with the backup script - but no, it's cron not
 sending the emails.
 
 I had this problem before on 6.1, which I never found a solution to. I
 gave up on it, and eventually I upgraded to 7.1. After the upgrade,
 cron worked perfectly. However, I just noticed that it stopped working
 again. I have no idea what changed (It's a production server, I
 haven't been playing with config files).
 
 User www's mail is redirected to root, which is redirected to a @gmail
 account via /etc/aliases.
 This is on 7.1-RELEASE-p3 running a custom kernel.
 
 Any solution to this problem would be fantastic. I use the emails from
 cron on a daily basis, and it really messes me up to have it not
 working.
 
 #
 # User www's crontab
 # Note, I also tried removing the MAILTO to no avail
 #
 MAILTO=root
 # m h   dom mon dow cmd
 *   *   *   *   *   echo Hello
 
 
 
 # /var/log/cron
 
 Mar  1 19:22:00 youcant /usr/sbin/cron[22627]: (operator) CMD
 (/usr/libexec/save-entropy)
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 Mar  1 19:22:00 youcant /usr/sbin/cron[22628]: (www) CMD (echo Hello)
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 group_compat, setgrent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 group_compat, endgrent, not found
 Mar  1 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): nis,
 passwd_compat, endpwent, not found
 
 
 
 
 # /var/log/maillog
 
 Mar  1 19:22:00 youcant sendmail[22630]: n21JM0Gl022630: from=www,
 size=0, class=0, nrcpts=0,
 msgid=200903011922.n21jm0gl022...@youcant.tastetherainbow.ws,
 relay=...@localhost

It looks like you're using user: www for your crontab.

Unfortunately, from /etc/passwd:

www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin

i.e user www can't do much without a shell.

Create a crontab as a user with a shell, MAILTO to your gmail account.

The user may want to be a member of a group with privileges. Or use
sudo.

Don't forget to add him to /var/cron/allow as per manpage for
crontab(1).

You could set SHELL in your crontab for www (might work) but I'd use a
different user who's a member of group operator maybe.

Hope that helps.

Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Cron Question

2008-09-06 Thread ElihuJ

Can anyone help me with this? Thank you again.
-- 
View this message in context: 
http://www.nabble.com/Cron-Question-tp19272656p19343758.html
Sent from the freebsd-questions mailing list archive at Nabble.com.

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


Re: Cron Question

2008-09-03 Thread Derek Ragona

At 10:45 AM 9/2/2008, ElihuJ wrote:


Hi all. I have a question about cron jobs that seem to be running to long or
with multiple copies of itself. For example, I have a backup script that I
run that seems to make multiple copies of itself. If I view the running
processes I see numerous instances of the same cron job. Is there something
I can do to limit this from happening? When it does, it drains my CPU and
some of my other processes are non responsive. Any help would be
appreciated. Thank you.
--
View this message in context: 
http://www.nabble.com/Cron-Question-tp19272656p19272656.html

Sent from the freebsd-questions mailing list archive at Nabble.com.


For longer running jobs I do a couple things.  I use a file to be sure only 
one instance is running, but I also add signal handling.  The following is 
written for ksh, but can be adapted to sh if needed:


=
#!/usr/local/bin/ksh
# uncomment the following line for debugging
#set -x


RUNNING_FILE=RUNNING_FILE=/tmp/my_cronjob_running
LOGFILE=LOGFILE=/tmp/my_cronjob.log
[EMAIL PROTECTED]
MAIL=/usr/bin/mail
TOUCH=/usr/bin/touch
RM=/bin/rm


# Print an epilog string and clear the RUNNING_FILE
function epilog {
  echo We are all done scanning.  $LOGFILE
$MAIL -s MyCronjob Report $SENDTO  $LOGFILE
if [ -f $RUNNING_FILE ]; then
$RM $RUNNING_FILE;
fi
}

function got_signal {
  echo Got a signal  $LOGFILE
  epilog
  exit
}


# Here pointers to signal handling subroutines are set
trap got_signal TERM HUP INT QUIT

if [ -f $RUNNING_FILE ]; then
echo mycronjob is already running
else
$TOUCH $RUNNING_FILE
$RM $LOGFILE
$TOUCH $LOGFILE
#   add your job to be done here . . .
#
epilog
fi

=


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

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


Re: Cron Question

2008-09-03 Thread ElihuJ

Thank you for the help. I changed the script to run Weekly instead of Daily.
If it was starting while it was still running, this should fix it. I'll post
my progress, and thank you again.
-- 
View this message in context: 
http://www.nabble.com/Cron-Question-tp19272656p19287970.html
Sent from the freebsd-questions mailing list archive at Nabble.com.

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


Re: Cron Question

2008-09-02 Thread Albert Shih
 Le 02/09/2008 à 08:45:52-0700, ElihuJ a écrit
 
 Hi all. I have a question about cron jobs that seem to be running to long or
 with multiple copies of itself. For example, I have a backup script that I
 run that seems to make multiple copies of itself. If I view the running
 processes I see numerous instances of the same cron job. Is there something
 I can do to limit this from happening? When it does, it drains my CPU and
 some of my other processes are non responsive. Any help would be
 appreciated. Thank you.

That's not the to cron to do that. You must put in your script some flags.

For example if you using 

rsnapshot (in the ports)

he put a lock file in /var/run (or what's ever you want) and don't start if
the script find this file. When the script is end the file is erase.

Something like

if_the_lock_file_exit :

exit 1

else

touch lock_file

my_script

rm lock_file

fi.

Regards

-- 
Albert SHIH
SIO batiment 15
Observatoire de Paris Meudon
5 Place Jules Janssen
92195 Meudon Cedex
Heure local/Local time:
Mar 2 sep 2008 18:01:25 CEST
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cron Question

2008-09-02 Thread Paul Schmehl
--On September 2, 2008 6:03:51 PM +0200 Albert Shih [EMAIL PROTECTED] 
wrote:



 Le 02/09/2008 à 08:45:52-0700, ElihuJ a écrit


Hi all. I have a question about cron jobs that seem to be running to
long or with multiple copies of itself. For example, I have a backup
script that I run that seems to make multiple copies of itself. If I
view the running processes I see numerous instances of the same cron
job. Is there something I can do to limit this from happening? When it
does, it drains my CPU and some of my other processes are non
responsive. Any help would be appreciated. Thank you.


That's not the to cron to do that.


Actually, it could be.  If the script is started by cron and is still 
running when the next job is scheduled, cron will start another process. 
If they're both still running when the next job is scheduled, you'll have 
three processes running, etc., etc.


The first thing I would do is run the script manually and see how long it 
takes to complete.  Then set your cron jobs up to run with enough time 
between them for the script to complete and exit before the next job 
starts.



Paul Schmehl, If it isn't already
obvious, my opinions are my own
and not those of my employer.
**
WARNING: Check the headers before replying


Re: Cron Question

2008-09-02 Thread Dan Nelson
In the last episode (Sep 02), Paul Schmehl said:
 --On September 2, 2008 6:03:51 PM +0200 Albert Shih wrote:
   Le 02/09/2008 à 08:45:52-0700, ElihuJ a écrit
  Hi all. I have a question about cron jobs that seem to be running
  to long or with multiple copies of itself. For example, I have a
  backup script that I run that seems to make multiple copies of
  itself. If I view the running processes I see numerous instances
  of the same cron job. Is there something I can do to limit this
  from happening? When it does, it drains my CPU and some of my
  other processes are non responsive. Any help would be appreciated.
  Thank you.
 
  That's not the to cron to do that.
 
 Actually, it could be.  If the script is started by cron and is still
 running when the next job is scheduled, cron will start another
 process.  If they're both still running when the next job is
 scheduled, you'll have three processes running, etc., etc.

I use the lockfile command ( from the procmail port ) to ensure that
recurring cron jobs don't overlap if one run takes too long. For
example, to run mrtg on a 1-minute cycle but prevent multiple mrtgs
from running if one run takes longer than 1 minute:

* * * * * /usr/local/bin/lockfile -r 1 -l 3600 /tmp/mrtg.LCK  ( nice -19 
/usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg ; rm /tmp/mrtg.LCK )

The -l 3600 tells lockfile to remove any lockfiles over an hour old (
if the machine was rebooted during an mrtg run for example )

-- 
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: Cron Question

2008-09-02 Thread RW
On Tue, 2 Sep 2008 11:40:37 -0500
Dan Nelson [EMAIL PROTECTED] wrote:


 I use the lockfile command ( from the procmail port ) to ensure that
 recurring cron jobs don't overlap if one run takes too long. For
 example, to run mrtg on a 1-minute cycle but prevent multiple mrtgs
 from running if one run takes longer than 1 minute:
 
 * * * * * /usr/local/bin/lockfile -r 1 -l 3600 /tmp/mrtg.LCK 
 ( nice -19 /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg ;
 rm /tmp/mrtg.LCK )
 
 The -l 3600 tells lockfile to remove any lockfiles over an hour old (
 if the machine was rebooted during an mrtg run for example )
 
you could also handle stale lock-files, without installing procmail,
like this:

   LCK=/tmp/foo.LCK
   find $LCK -mtime +3600s -delete
   if ![ -f $LCK ] ; then
   touch $LCK
   [ -f $LCK ]  foo 
   rm $LCK
   fi

Presumably the lockfile command also eliminates the race between testing
for, and creating, the lock-file, but that's not really needed here.

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


Re: [CRON] Recommended FTP client to download and upload files?

2008-05-09 Thread Gilles
On Sat, 03 May 2008 16:46:27 +0200, Gilles [EMAIL PROTECTED]
wrote:
What command-line FTP client would you recommend for this?

It looks like lftp is not running like I thought it would :/ Until I
ran the following commands manually instead of through CRON, some
files on the remote source FTP server dated May 6th/7th were not
downloaded locally and then uploaded to the target remote FTP server:

1. Here's the script:

# cat /var/sync.bash 

#!/usr/local/bin/bash
echo Downloading from Source FTP
lftp -u joe,sixpack -e mirror -vn ./files /var/depot  bye
ftp.source.com

echo Uploading to Target FTP
lftp -u joe,sixpack -e mirror -vnR /var/depot ./downloads  bye
ftp.target.com

2. When run manually:

# ./sync.bash 
Downloading from Source FTP
Total : 1 directory, 41 files, 0 symlinks
Uploading to Target FTP
Total : 1 directory, 41 files, 0 symlinks
To be removed: 0 directories, 2 files, 0 symlinks

3. CRON:

# crontab -l
5,35 * * * * /var/sync.bash /dev/null 21

= What does To be removed: 0 directories, 2 files, 0 symlinks
actually mean?

Thanks for any tip.

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


Re: [CRON] Recommended FTP client to download and upload files?

2008-05-09 Thread Gilles
On Sat, 10 May 2008 01:53:13 +0200, Gilles [EMAIL PROTECTED]
wrote:
It looks like lftp is not running like I thought it would

Found what it was: The script worked fine when ran manually, but
failed when ran by CRON because it couldn't locate lftp:

Downloading from Source FTP
/var/sync.bash: line 3: lftp: command not found
Uploading to Target FTP
/var/sync.bash: line 6: lftp: command not found

Moral of the story: Start by leaving error messages as is before
redirectering them to /dev/null once the script proved to work.

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


Re: [CRON] Recommended FTP client to download and upload files?

2008-05-04 Thread Gilles
On Sat, 03 May 2008 11:34:30 -0700, prad [EMAIL PROTECTED]
wrote:
i like lftp the best. you can script it and everything has always
worked smoothly for me using it.

Thanks guys, lftp did the job. I'll put those two lines in a script
and add it to CRON:

lftp -u joe,mypass -e mirror -vn ./files ./mirror  bye
ftp.source.com

lftp -u joe,mypass -e mirror -vnR ./mirror ./files  bye
ftp.target.com

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


Re: [CRON] Recommended FTP client to download and upload files?

2008-05-03 Thread Andrew Pantyukhin
On Sat, May 03, 2008 at 04:46:27PM +0200, Gilles wrote:
 Hello
 
   I need to run a CRON job to download files from one FTP server if
 they're more recent, and upload them to another FTP server. The files
 all live in one directory, so there's no need for recursion.
 
 What command-line FTP client would you recommend for this?

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


Re: [CRON] Recommended FTP client to download and upload files?

2008-05-03 Thread Jeffrey Goldberg

On May 3, 2008, at 9:46 AM, Gilles wrote:


I need to run a CRON job to download files from one FTP server if
they're more recent, and upload them to another FTP server. The files
all live in one directory, so there's no need for recursion.

What command-line FTP client would you recommend for this?


lftp in ports.

It is very scriptable and has built in facilities to only copy newer  
files.


Cheers,

-j

--
Jeffrey Goldberghttp://www.goldmark.org/jeff/

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


Re: [CRON] Recommended FTP client to download and upload files?

2008-05-03 Thread prad
On Sat, 03 May 2008 16:46:27 +0200
Gilles [EMAIL PROTECTED] wrote:

 What command-line FTP client would you recommend for this?

i like lftp the best. you can script it and everything has always
worked smoothly for me using it.

-- 
In friendship,
prad

  ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cron question

2008-04-26 Thread John Almberg


On Apr 25, 2008, at 10:31 AM, John Almberg wrote:



...and invoking this wrapper from cron instead of trying to reset  
the shell and everything from within cron.  You can test things by  
doing an su gs -c /bin/sh from a root login and then trying to  
run your wrapper, which will give you a minimum environment closer  
to what cron executes under.




This was an interesting idea. I wrote a little ruby script to print  
out all set environment variable, then ran it under the simulated  
cron environment:


bin 520 $ su gs -c /bin/sh
$ ./env.rb
USER = gs
MAIL = /var/mail/gs
SHLVL = 2
HOME = /home/gs
_ = /bin/sh
BLOCKSIZE = K
TERM = xterm-color
SVN_EDITOR = vim
PATH = /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/ 
usr/local/bin:/usr/X11R6/bin:/home/gs/bin

SHELL = /usr/local/bin/bash
PWD = /home/gs/bin
FTP_PASSIVE_MODE = YES
EDITOR = vim
$

Then under the environment I used to run the script by hand:

[EMAIL PROTECTED] ~/bin]$ ./env.rb
TERM = xterm-color
SHELL = /usr/local/bin/bash
OLDPWD = /home/gs
SSH_TTY = /dev/ttyp0
USER = gs
SVN_EDITOR = vim
FTP_PASSIVE_MODE = YES
MAIL = /var/mail/identry
PATH = /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/ 
usr/local/bin:/usr/X11R6/bin:/home/identry/bin

BLOCKSIZE = K
PWD = /home/gs/bin
EDITOR = vim
HOME = /home/gs
SHLVL = 2
LOGNAME = identry
_ = ./env.rb

I don't see any difference that would explain this problem...

No mail is sent to either root or gs when the crontab runs.



Well, I finally figure this out. Printing out the environment  
variables when running the program by hand, and then when it ran as a  
crontab, turned out to be the key. The difference (not shown in the  
early experiment, above) was in the working directory. When I ran the  
script by hand, the working directory was /home/gs/bin, but when cron  
ran the script, the working directory was /home/gs. Unfortunately,  
this caused the script to die, because of a bug in the script itself.


Now that this script is running, the big question is, why are none of  
my login users getting any email? I'm sure that cron tried to send an  
email about the error that would have been helpful in debugging the  
problem, but it never arrived. But all the mailboxes in /var/mail are  
empty.


I am running qmail, which is also new for me... Like all djb stuff,  
it works great, but is stunningly difficult for my feeble brain to  
understand... I need to roll up my sleeves and try to understand  
what's happening to this mail.


Anyway, thanks for the help. It was definitely useful in putting me  
on the right track.


Brgds: John

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


Re: Cron question

2008-04-25 Thread John Almberg


...and invoking this wrapper from cron instead of trying to reset  
the shell and everything from within cron.  You can test things by  
doing an su gs -c /bin/sh from a root login and then trying to  
run your wrapper, which will give you a minimum environment closer  
to what cron executes under.




This was an interesting idea. I wrote a little ruby script to print  
out all set environment variable, then ran it under the simulated  
cron environment:


bin 520 $ su gs -c /bin/sh
$ ./env.rb
USER = gs
MAIL = /var/mail/gs
SHLVL = 2
HOME = /home/gs
_ = /bin/sh
BLOCKSIZE = K
TERM = xterm-color
SVN_EDITOR = vim
PATH = /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ 
local/bin:/usr/X11R6/bin:/home/gs/bin

SHELL = /usr/local/bin/bash
PWD = /home/gs/bin
FTP_PASSIVE_MODE = YES
EDITOR = vim
$

Then under the environment I used to run the script by hand:

[EMAIL PROTECTED] ~/bin]$ ./env.rb
TERM = xterm-color
SHELL = /usr/local/bin/bash
OLDPWD = /home/gs
SSH_TTY = /dev/ttyp0
USER = gs
SVN_EDITOR = vim
FTP_PASSIVE_MODE = YES
MAIL = /var/mail/identry
PATH = /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ 
local/bin:/usr/X11R6/bin:/home/identry/bin

BLOCKSIZE = K
PWD = /home/gs/bin
EDITOR = vim
HOME = /home/gs
SHLVL = 2
LOGNAME = identry
_ = ./env.rb

I don't see any difference that would explain this problem...

No mail is sent to either root or gs when the crontab runs.

Someone asked what version of PHP...

~ 504 $ php --version
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan  6 2008 18:26:54)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
~ 505 $

And if bash is really installed:

~ 505 $ bash --version
GNU bash, version 3.2.33(0)-release (amd64-portbld-freebsd6.3)
Copyright (C) 2007 Free Software Foundation, Inc.

I guess I will try using the shell script wrapper idea, to some more  
experiments in a more controlled environment.


-- John

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


Re: Cron question

2008-04-24 Thread Chuck Swiger

On Apr 24, 2008, at 1:26 PM, John Almberg wrote:
The trouble comes when I try to run this script with cron. I have  
something like this in the gs user crontab:


SHELL=/usr/local/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ 
local/bin:/usr/X11R6/bin:/home/gs/bin

HOME=/home/gs
0 15 * * * /home/gs/bin/script.php /home/gs/log/script.log

I can see from the cron log that cron runs script.php at the  
appointed hour:


	Apr 24 15:00:03 on /usr/sbin/cron[72414]: (gs) CMD (/home/gs/bin/ 
script.php /home/gs/log/script.log)


I believe that you are going to be better off writing a trivial  
wrapper like:


-

#! /usr/local/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/ 
local/bin:/usr/X11R6/bin:/home/gs/bin

# ...other env variables you need...

touch /home/gs/log/script.log
/home/gs/bin/script.php  /home/gs/log/script.log

-

...and invoking this wrapper from cron instead of trying to reset the  
shell and everything from within cron.  You can test things by doing  
an su gs -c /bin/sh from a root login and then trying to run your  
wrapper, which will give you a minimum environment closer to what cron  
executes under.


--
-Chuck

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


Re: Cron question

2008-04-24 Thread Wojciech Puchar
0 15 * * * /usr/local/bin/php /home/gs/bin/script.php 

/home/gs/log/script.log


looks right. check mail - cron sends mail if something is wrong
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cron question

2008-04-24 Thread Matt
On Thu, Apr 24, 2008 at 3:26 PM, John Almberg [EMAIL PROTECTED] wrote:
  SHELL=/usr/local/bin/bash

Did you install bash from ports and does it run OK from outside of cron?


 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/gs/bin
  HOME=/home/gs
  0 15 * * * /home/gs/bin/script.php /home/gs/log/script.log

  I can see from the cron log that cron runs script.php at the appointed
 hour:

 Apr 24 15:00:03 on /usr/sbin/cron[72414]: (gs) CMD
 (/home/gs/bin/script.php /home/gs/log/script.log)

This entry in the cron log will still show up if the shell listed in
the crontab is not available.  However, as someone else already
mentioned, cron sends a mail when it goes to run and can't execute the
shell.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron to attach a gz file

2008-02-01 Thread Mel
On Friday 01 February 2008 08:48:02 Peter Boosten wrote:
 [EMAIL PROTECTED] wrote:
  I know I can use
 
  mail -s logfile   /var/log/httpd_access.log
 
  in cron to email the content of a log file to a particular email
  address but how do I make that log file a binary attachment (*.gz)?
 
  gzip -c /var/log/httpd_access.log | uuencode httpd_access.log.gz | mail
  -s logfile [EMAIL PROTECTED]
 
  If you want an actual MIME attachment, see /usr/ports/mail/nail

Nice tip, thanks for that.

  From a modern mail reader point of view there is not much difference
 between a MIME or a uuencoded attachment.

But there is between an uuencoded /body/ and an attachment.

At the risk of this degrading into a mail useragent battle: kmail didn't give 
an option to uudecode the body.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron to attach a gz file

2008-01-31 Thread Peter Boosten

Zbigniew Szalbot wrote:

Hello,

I know I can use

mail -s logfile   /var/log/httpd_access.log

in cron to email the content of a log file to a particular email
address but how do I make that log file a binary attachment (*.gz)?


gzip -c /var/log/httpd_access.log | uuencode httpd_access.log.gz | mail 
-s logfile [EMAIL PROTECTED]


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


Re: cron to attach a gz file

2008-01-31 Thread perryh
  I know I can use
  
  mail -s logfile   /var/log/httpd_access.log
  
  in cron to email the content of a log file to a particular email
  address but how do I make that log file a binary attachment (*.gz)?

 gzip -c /var/log/httpd_access.log | uuencode httpd_access.log.gz | mail 
 -s logfile [EMAIL PROTECTED]

If you want an actual MIME attachment, see /usr/ports/mail/nail
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron to attach a gz file

2008-01-31 Thread Peter Boosten

[EMAIL PROTECTED] wrote:

I know I can use

mail -s logfile   /var/log/httpd_access.log

in cron to email the content of a log file to a particular email
address but how do I make that log file a binary attachment (*.gz)?
gzip -c /var/log/httpd_access.log | uuencode httpd_access.log.gz | mail 
-s logfile [EMAIL PROTECTED]


If you want an actual MIME attachment, see /usr/ports/mail/nail


From a modern mail reader point of view there is not much difference 
between a MIME or a uuencoded attachment.


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


Re: cron pile up! Lot's of cron: running job (cron)

2007-12-15 Thread Kevin Kinsey

Rudy wrote:
The thing is, sometimes it runs fine, other times it backlogs (It may 
complete at a latter date... the PID 82253 is still waiting ... Gonna 
see it it completes instead of killing all the stuck crons...).




All the crons are cleared out right now... 'ps' shows only crond.  
Related to putting the other cron job in  marks???




Well, I think I messed up in my suggestion, by omitting the
CRON at the end.  My point/thought was, put the entire command
/path/to/script.sh  ARG in quotes.

Cron is pretty archaic, and I wondered if it was trying to
run /path/to/script.sh and ARG as two jobs instead of
one, and hanging on ARG since CRON is something of a 
reserved word.  IANAE, YMMV, and all that.


Kevin Kinsey
--
I like myself, but I won't say I'm as handsome as the bull
that kidnapped Europa.
-- Marcus Tullius Cicero
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron pile up! Lot's of cron: running job (cron)

2007-12-15 Thread Ian Smith
On Sat, 15 Dec 2007 16:18:31 -0600 Kevin Kinsey [EMAIL PROTECTED] wrote:
  Rudy wrote:
   The thing is, sometimes it runs fine, other times it backlogs (It may 
   complete at a latter date... the PID 82253 is still waiting ... Gonna 
   see it it completes instead of killing all the stuck crons...).
  
   
   All the crons are cleared out right now... 'ps' shows only crond.  
   Related to putting the other cron job in  marks???
   
  
  Well, I think I messed up in my suggestion, by omitting the
  CRON at the end.  My point/thought was, put the entire command
  /path/to/script.sh  ARG in quotes.
  
  Cron is pretty archaic, and I wondered if it was trying to
  run /path/to/script.sh and ARG as two jobs instead of
  one, and hanging on ARG since CRON is something of a 
  reserved word.  IANAE, YMMV, and all that.

MMV :)  The following has been merrily running on three boxes, the
oldest of them for, um, 9.5 years: 

*/5 *   *   *   *   root/root/bin/ipfwsnap cron

Yes, 'cron' is a checked and logged argument to ipfwsnap.  Various other
/etc/crontab entries demonstrate no need to enclose arguments in quotes,
except where they'd be necessary anyway - as per examples in crontab(5)

Cheers, Ian

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


Re: cron pile up! Lot's of cron: running job (cron)

2007-12-13 Thread Rudy

Dan Nelson wrote:

In the last episode (Dec 03), Support (Rudy) said:

Below is part of the cron...  Seems like any random cronjob can get
clogged up... load varies from 0.2 to 1.0 on this dual-core box.  I
rebooted the box -- cron's continue to slowly pile up.

One of the cronjobs that is 'stuck' is this one: /root/bin/raid-status.sh
which can be found here:
 http://www.monkeybrains.net/~rudy/example/raid_status.html

Forgot to mention, I am running:
  6.2-STABLE FreeBSD 6.2-STABLE #3: Thu May 31 01:18:15 PDT 2007

OH, ps shows this:
58383  ??  D  0:00.00 cron: running job (cron)
58384  ??  IVs0:00.00 cron: running job (cron)


In general, when troubleshhoting, ps axlw is a more useful command.
It adds among other columns, the MWCHAN one, which details exactly why
a process is stuck in the D state.  


Anyway, cron does a fork and then a vfork creating a child and a
grandchild process.  I'm sort of surprised at the amount of code
between vfork and exec in the grandchild in
/src/usr.sbin/cron/cron/do_command.c .  Since process 3 is actually
using process 2's address space one must be extremely careful not to
modify static variables or change other global state that would affect
the parent once it resumes execution, and all the logging,
environment-setting, and user-context calls are certain to mess with
the parent's state, especially with nss modules in the mix.  I'd
personally recompile cron with all vforks replaced with fork and see
what happens.

It couldn't hurt to update to a newer kernel version along the RELENG_6
branch as a test, I guess.  Note that your uname will change to
6.3-PRERELEASE, but apart from causing lsof to complain, you should be
okay.


/var/log/cron has this entry:
Dec  3 20:16:00 pita /usr/sbin/cron[58384]: (root) CMD  
(/root/bin/raid-status.sh CRON)

BUT there is no 'raid-status.sh' stuck in the ps axw.  Seems like the 
vfork set off the cronjob, it ran, but then cron didn't 'stop' executing.  
Any debuggin tips?


Can you tell if raid-status.sh ever ran?  i.e. is process 2
stuck at the start of vfork or at the end.


I added this line to the top of my cronjob:
 logger -t DEBUG $0: $$
and cron seems stuck BEFORE the script is ever run.  Whether it sticks or not appears random, as 
plenty of log lines are showing up with the output of the logger command in my /var/log/messages.


# tail /var/log/messages
Dec 13 11:16:00 pita DEBUG: /root/bin/raid-status.sh: 64414
Dec 13 12:00:00 pita DEBUG: /root/bin/raid-status.sh: 80115
Dec 13 12:00:00 pita DEBUG: /root/bin/raid-status.sh: 80119
Dec 13 12:11:00 pita DEBUG: /root/bin/raid-status.sh: 84283

Here is the ps output:
# ps axlw
  UID   PID  PPID CPU PRI NI   VSZ   RSS MWCHAN STAT  TT   TIME COMMAND
0 85939 82253   0   8  0  2148  1560 ppwait D ??0:00.00 cron: 
running job (cron)
0 85940 85939   0   4  0  2148  1560 sbwait IVs   ??0:00.00 cron: 
running job (cron)
# grep 85940 /var/log/cron
Dec 13 12:16:00 pita /usr/sbin/cron[85940]: (root) CMD 
(/root/bin/raid-status.sh CRON)

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


Re: cron pile up! Lot's of cron: running job (cron)

2007-12-13 Thread Kevin Kinsey

Rudy wrote:

Dan Nelson wrote:

In the last episode (Dec 03), Support (Rudy) said:

Below is part of the cron...  Seems like any random cronjob can get
clogged up... load varies from 0.2 to 1.0 on this dual-core box.  I
rebooted the box -- cron's continue to slowly pile up.

One of the cronjobs that is 'stuck' is this one: 
/root/bin/raid-status.sh

which can be found here:
 http://www.monkeybrains.net/~rudy/example/raid_status.html

Forgot to mention, I am running:
  6.2-STABLE FreeBSD 6.2-STABLE #3: Thu May 31 01:18:15 PDT 2007

OH, ps shows this:
58383  ??  D  0:00.00 cron: running job (cron)
58384  ??  IVs0:00.00 cron: running job (cron)


In general, when troubleshhoting, ps axlw is a more useful command.
It adds among other columns, the MWCHAN one, which details exactly why
a process is stuck in the D state. 
Anyway, cron does a fork and then a vfork creating a child and a

grandchild process.  I'm sort of surprised at the amount of code
between vfork and exec in the grandchild in
/src/usr.sbin/cron/cron/do_command.c .  Since process 3 is actually
using process 2's address space one must be extremely careful not to
modify static variables or change other global state that would affect
the parent once it resumes execution, and all the logging,
environment-setting, and user-context calls are certain to mess with
the parent's state, especially with nss modules in the mix.  I'd
personally recompile cron with all vforks replaced with fork and see
what happens.

It couldn't hurt to update to a newer kernel version along the RELENG_6
branch as a test, I guess.  Note that your uname will change to
6.3-PRERELEASE, but apart from causing lsof to complain, you should be
okay.


/var/log/cron has this entry:
Dec  3 20:16:00 pita /usr/sbin/cron[58384]: (root) CMD  
(/root/bin/raid-status.sh CRON)


BUT there is no 'raid-status.sh' stuck in the ps axw.  Seems like 
the vfork set off the cronjob, it ran, but then cron didn't 'stop' 
executing.  Any debuggin tips?


Can you tell if raid-status.sh ever ran?  i.e. is process 2
stuck at the start of vfork or at the end.


I added this line to the top of my cronjob:
 logger -t DEBUG $0: $$
and cron seems stuck BEFORE the script is ever run.  Whether it sticks 
or not appears random, as plenty of log lines are showing up with the 
output of the logger command in my /var/log/messages.


# tail /var/log/messages
Dec 13 11:16:00 pita DEBUG: /root/bin/raid-status.sh: 64414
Dec 13 12:00:00 pita DEBUG: /root/bin/raid-status.sh: 80115
Dec 13 12:00:00 pita DEBUG: /root/bin/raid-status.sh: 80119
Dec 13 12:11:00 pita DEBUG: /root/bin/raid-status.sh: 84283

Here is the ps output:
# ps axlw
  UID   PID  PPID CPU PRI NI   VSZ   RSS MWCHAN STAT  TT   TIME COMMAND
0 85939 82253   0   8  0  2148  1560 ppwait D ??0:00.00 
cron: running job (cron)
0 85940 85939   0   4  0  2148  1560 sbwait IVs   ??0:00.00 
cron: running job (cron)

# grep 85940 /var/log/cron
Dec 13 12:16:00 pita /usr/sbin/cron[85940]: (root) CMD 
(/root/bin/raid-status.sh CRON)


- Rudy


Just as a favor to an old coot, could you change your
crontab entry to read like this:

*/16  *  *  *  *  /root/bin/raid-status.sh

and see if it makes any difference?

Kevin Kinsey
--
There are never any bugs you haven't found yet.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron pile up! Lot's of cron: running job (cron)

2007-12-03 Thread Kevin Kinsey

Rudy wrote:


cron jobs seem to get stuck.  Not always, but within a day, there are at
least 20 stuck.  It is not always the same cronjob that does the
sticking.  :)   When this occurs, I can run ps ax| grep cron and get a
bunch of lines like this:

51921  ??  D  0:00.00 cron: running job (cron)
51922  ??  IVs0:00.00 cron: running job (cron)
52544  ??  D  0:00.00 cron: running job (cron)
52545  ??  IVs0:00.00 cron: running job (cron)
54418  ??  D  0:00.00 cron: running job (cron)
54419  ??  IVs0:00.00 cron: running job (cron)
54667  ??  D  0:00.00 cron: running job (cron)
54668  ??  IVs0:00.00 cron: running job (cron)
55835  ??  D  0:00.00 cron: running job (cron)
55836  ??  IVs0:00.00 cron: running job (cron)

What is going on?  Please help me remedy this situation.

The PID numbers next to cron's with a STATE of IVs show up in
/var/log/cron, for example:

# grep 54668 /var/log/cron
Dec  2 22:32:00 pita /usr/sbin/cron[54668]: (root) CMD
(/root/bin/raid-status.sh CRON)
# grep 55836 /var/log/cron
Dec  2 22:40:00 pita /usr/sbin/cron[55836]: (root) CMD
(/root/bin/10minutes.mail.sh | mail -E -s [ERROR]
mail.monkeybrains.net  [EMAIL PROTECTED])


If I run 'lsof' I can find these open handles:

cron  54668 root  cwd   VDIR   0,80512   
471040 /var/cron
cron  54668 root  rtd   VDIR   0,77
5122 /
cron  54668 root  txt   VREG   0,82  32496   
122864 /usr/sbin/cron
cron  54668 root  txt   VREG   0,77 162712
49929 /libexec/ld-elf.so.1
cron  54668 root  txt   VREG   0,77  44788
49922 /lib/libutil.so.5
cron  54668 root  txt   VREG   0,77 941952
49923 /lib/libc.so.6
cron  54668 root  txt   VREG   0,82  19277   
826439 /usr/local/lib/nss_mysql.so.1
cron  54668 root  txt   VREG   0,82 413626   
826986 /usr/local/lib/mysql/libmysqlclient.so.15
cron  54668 root  txt   VREG   0,77  64604
49928 /lib/libz.so.3
cron  54668 root  txt   VREG   0,77 107432
49918 /lib/libm.so.4
cron  54668 root  txt   VREG   0,77  28648
49916 /lib/libcrypt.so.3
cron  54668 root0u  PIPE 0xca02c660  
16384  -0xca02c718
cron  54668 root1u  PIPE 0xcc473250  
0  -0xcc473198
cron  54668 root2u  PIPE 0xcc473250  
0  -0xcc473198
cron  54668 root5u  unix 0xc6665858
0t0  -0xc67e89bc
cron  54667 root  cwd   VDIR   0,80512   
471040 /var/cron
cron  54667 root  rtd   VDIR   0,77
5122 /
cron  54667 root  txt   VREG   0,82  32496   
122864 /usr/sbin/cron
cron  54667 root  txt   VREG   0,77 162712
49929 /libexec/ld-elf.so.1
cron  54667 root  txt   VREG   0,77  44788
49922 /lib/libutil.so.5
cron  54667 root  txt   VREG   0,77 941952
49923 /lib/libc.so.6
cron  54667 root  txt   VREG   0,82  19277   
826439 /usr/local/lib/nss_mysql.so.1
cron  54667 root  txt   VREG   0,82 413626   
826986 /usr/local/lib/mysql/libmysqlclient.so.15
cron  54667 root  txt   VREG   0,77  64604
49928 /lib/libz.so.3
cron  54667 root  txt   VREG   0,77 107432
49918 /lib/libm.so.4
cron  54667 root  txt   VREG   0,77  28648
49916 /lib/libcrypt.so.3
cron  54667 root0u  VCHR   0,260t0   
26 /dev/null
cron  54667 root1u  VCHR   0,260t0   
26 /dev/null
cron  54667 root2u  VCHR   0,260t0   
26 /dev/null
cron  54667 root3u  PIPE 0xca02c660  
16384  -0xca02c718
cron  54667 root4u  PIPE 0xca02c718  
0  -0xca02c660
cron  54667 root5u  unix 0xc6665858
0t0  -0xc67e89bc
cron  54667 root6u  PIPE 0xcc473198  
16384  -0xcc473250
cron  54667 root7u  unix 0xc67e86f4
0t0  -(none)
cron  54667 root8u  PIPE 0xcc473250  
0  -0xcc473198


What is going on?  Is my libnss_mysql acting up?


What scripts are running?  Care to sanitize the crontab
file and show it as well?  Barring hardware issues (disk
errors, etc.), I'd suspect the scripts.

What about server load averages?

KDK
--
Law of Continuity:
Experiments should be reproducible.
They should all fail the same way.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions

Re: cron pile up! Lot's of cron: running job (cron)

2007-12-03 Thread Support (Rudy)


Below is part of the cron...  Seems like any random cronjob can get clogged up... load varies from 
0.2 to 1.0 on this dual-core box.  I rebooted the box -- cron's continue to slowly pile up.



One of the cronjobs that is 'stuck' is this one: /root/bin/raid-status.sh
which can be found here:
 http://www.monkeybrains.net/~rudy/example/raid_status.html

Forgot to mention, I am running:
  6.2-STABLE FreeBSD 6.2-STABLE #3: Thu May 31 01:18:15 PDT 2007

OH, ps shows this:
58383  ??  D  0:00.00 cron: running job (cron)
58384  ??  IVs0:00.00 cron: running job (cron)
/var/log/cron has this entry:
Dec  3 20:16:00 pita /usr/sbin/cron[58384]: (root) CMD 
(/root/bin/raid-status.sh CRON)

BUT there is no 'raid-status.sh' stuck in the ps axw.  Seems like the vfork set off the cronjob, 
it ran, but then cron didn't 'stop' executing.  Any debuggin tips?


Rudy

---

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/root/bin
[EMAIL PROTECTED]

  Root Cron for example.net  

##
# check demons, limit sendmail, generate fwdmail aliases
##
*/10 * * * * /root/bin/10minutes.mail.sh | mail -E -s [ERROR] example.monkeybrains.net 
[EMAIL PROTECTED]

 */16 * * * * /root/bin/raid-status.sh CRON

##
# Anti-Spam measures
##
1 5 * * * /usr/local/etc/mail/blacklist2access.pl  | /usr/bin/mail -E -s [INFO] mail: 
blacklist2access script  [EMAIL PROTECTED]


## update the rules/balcklists list
40 5 * * * /usr/local/bin/sa-update --allowplugins --gpgkey 
D1C035168C1EBC08464946DA258CDB3ABDE9DC10 --channel saupdates.openprotect.com  
/usr/local/etc/rc.d/sa-spamd restart
48 5 * * * /usr/local/bin/sa-update  --channel updates.spamassassin.org  
/usr/local/etc/rc.d/sa-spamd restart


## and anti-virus
49 */2 * * *  su -m clamav -c '/usr/local/bin/freshclam --quiet'
@weekly /usr/bin/find /var/tmp/ -maxdepth 1 -and -path *clamav* -and -type d -and \! -newermt '2 
days ago' -and -delete





###
#  Clean stuff up
#  old trash, viruses, old spam,  and  authdaemon cache
###
## squirrelmail attachments
45 3 * * * /usr/bin/find /var/spool/squirrelmail/attach \! -newermt '9 day ago' 
-delete
## stuff marked as Trash or in Trash folder
55 3 * * * /usr/bin/find /home /data/virtual/ -path */Maildir/* -and -name *:*T -and \! 
-newermt '2 day ago' -delete
35 3 * * * /usr/bin/find /home/ /data/virtual/ -path */Maildir/.Trash/* -name *net* -and \! 
-newermt '4 day ago' -delete



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


Re: cron pile up! Lot's of cron: running job (cron)

2007-12-03 Thread Dan Nelson
In the last episode (Dec 03), Support (Rudy) said:
 Below is part of the cron...  Seems like any random cronjob can get
 clogged up... load varies from 0.2 to 1.0 on this dual-core box.  I
 rebooted the box -- cron's continue to slowly pile up.
 
 One of the cronjobs that is 'stuck' is this one: /root/bin/raid-status.sh
 which can be found here:
  http://www.monkeybrains.net/~rudy/example/raid_status.html
 
 Forgot to mention, I am running:
   6.2-STABLE FreeBSD 6.2-STABLE #3: Thu May 31 01:18:15 PDT 2007
 
 OH, ps shows this:
 58383  ??  D  0:00.00 cron: running job (cron)
 58384  ??  IVs0:00.00 cron: running job (cron)

In general, when troubleshhoting, ps axlw is a more useful command.
It adds among other columns, the MWCHAN one, which details exactly why
a process is stuck in the D state.  

Anyway, cron does a fork and then a vfork creating a child and a
grandchild process.  I'm sort of surprised at the amount of code
between vfork and exec in the grandchild in
/src/usr.sbin/cron/cron/do_command.c .  Since process 3 is actually
using process 2's address space one must be extremely careful not to
modify static variables or change other global state that would affect
the parent once it resumes execution, and all the logging,
environment-setting, and user-context calls are certain to mess with
the parent's state, especially with nss modules in the mix.  I'd
personally recompile cron with all vforks replaced with fork and see
what happens.

It couldn't hurt to update to a newer kernel version along the RELENG_6
branch as a test, I guess.  Note that your uname will change to
6.3-PRERELEASE, but apart from causing lsof to complain, you should be
okay.

 /var/log/cron has this entry:
 Dec  3 20:16:00 pita /usr/sbin/cron[58384]: (root) CMD  
 (/root/bin/raid-status.sh CRON)
 
 BUT there is no 'raid-status.sh' stuck in the ps axw.  Seems like the 
 vfork set off the cronjob, it ran, but then cron didn't 'stop' executing.  
 Any debuggin tips?

Can you tell if raid-status.sh ever ran?  i.e. is process 2
stuck at the start of vfork or at the end.

BTW, here's a minimal example of the danger of putting code between
vfork and exec:

#include err.h
#include stdio.h
#include unistd.h

int main(void)
{
int i = 1;
switch (vfork())
{
case -1:
err(1, vfork failed);
break;
case 0:
/* child */
i = 2;
execl(/usr/bin/true, true, NULL);
_exit(0);
break;
default:
break;
}
printf(in parent, i is %d\n, i);
return 0;
}


-- 
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: cron/send mail question

2007-11-15 Thread Steve Bertrand
zbigniew szalbot wrote:
 Dear all,
 
 What command (when using cron) should I invoke to automatically sent
 /var/log/exim/rejectlog file to a specified email address? I just need
 to analyze it and would best prefer to have it in my inbox in the morning.

The following should be on one line in crontab :

1 * * * * mail -s File contents [EMAIL PROTECTED]  /home/steveb/file.name

It will send your file to you inline in an email ad one minute after
midnight every day.

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


Re: cron/send mail question

2007-11-15 Thread cknipe
existats comes to mind as well.  Does the whole analyze thing for you... 


Quoting Steve Bertrand [EMAIL PROTECTED]:

 zbigniew szalbot wrote:
  Dear all,
  
  What command (when using cron) should I invoke to automatically sent
  /var/log/exim/rejectlog file to a specified email address? I just need
  to analyze it and would best prefer to have it in my inbox in the morning.
 
 The following should be on one line in crontab :
 
 1 * * * * mail -s File contents [EMAIL PROTECTED]  /home/steveb/file.name
 
 It will send your file to you inline in an email ad one minute after
 midnight every day.
 
 Steve
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [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: cron/send mail question

2007-11-15 Thread Giorgos Keramidas
On 2007-11-15 13:47, zbigniew szalbot [EMAIL PROTECTED] wrote:
 Dear all,
 What command (when using cron) should I invoke to automatically sent
 /var/log/exim/rejectlog file to a specified email address? I just need
 to analyze it and would best prefer to have it in my inbox in the
 morning.

There are several ways.

(1) Add a new shell script to `/usr/local/etc/periodic/daily'.

(2) Add the commands you want to run in `/etc/daily.local'.

(3) Add a cronjob in `/etc/crontab' to run a custom script.


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


RE: Cron not working till 28/08/07

2007-09-19 Thread Matthijs Breemans
Hello,

Can you give some more info, like posting te crontab?

Matthijs

-Oorspronkelijk bericht -
Van: DSA - JCR [EMAIL PROTECTED]
Aan: freebsd-questions@freebsd.org
Verzonden: 19-9-07 14:36
Onderwerp: Cron not working till 28/08/07

Hi all !!

I had several crontab jobs in order to make backups.

All worked fine till the 28-Aug-2007 when it seems to be stopped for some
reason, I don't know why.
I had a reporting in my mail box (external) also with daily, weekly and
monthly reports, but suddenly all stopped (I don't receive nothing in my
email).

Can you help me?



Thanks in advance

Juan Coruña
Desarrollo de Software Atlantico




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [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: Cron not working till 28/08/07

2007-09-19 Thread Harry Matthiesen Jensen
On Wed, Sep 19, 2007 at 12:36:07PM -, DSA - JCR wrote:
 I had several crontab jobs in order to make backups.
 
 All worked fine till the 28-Aug-2007 when it seems to be stopped for some
 reason, I don't know why.

Does the command whereis crontab give you any feedback?

Performed a buildworld close to the date you mentioned?

..and how does the cron files look like?

-- 
Mvh Harry
FreeBSD 7.0-CURRENT Sep 15 19:08:08 2007 i386
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cron not working till 28/08/07

2007-09-19 Thread RW
On Wed, 19 Sep 2007 12:36:07 - (GMT)
DSA - JCR [EMAIL PROTECTED] wrote:

 Hi all !!
 
 I had several crontab jobs in order to make backups.
 
 All worked fine till the 28-Aug-2007 when it seems to be stopped for
 some reason, I don't know why.
 I had a reporting in my mail box (external) also with daily, weekly
 and monthly reports, but suddenly all stopped (I don't receive
 nothing in my email).

Have you checked it's not an email problem with block-lists, spam
filters etc.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cron not working till 28/08/07

2007-09-19 Thread Derek Ragona

At 07:36 AM 9/19/2007, DSA - JCR wrote:

Hi all !!

I had several crontab jobs in order to make backups.

All worked fine till the 28-Aug-2007 when it seems to be stopped for some
reason, I don't know why.
I had a reporting in my mail box (external) also with daily, weekly and
monthly reports, but suddenly all stopped (I don't receive nothing in my
email).

Can you help me?



Thanks in advance

Juan Coruña
Desarrollo de Software Atlantico


Have you checked the system clock?  Often cron jobs stop running when a 
server is rebooted with incorrect time and date.


-Derek

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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


Re: Cron not working till 28/08/07

2007-09-19 Thread Jerry McAllister

Hi,

On Wed, Sep 19, 2007 at 12:36:07PM -, DSA - JCR wrote:

 Hi all !!
 
 I had several crontab jobs in order to make backups.
 
 All worked fine till the 28-Aug-2007 when it seems to be stopped for some
 reason, I don't know why.
 I had a reporting in my mail box (external) also with daily, weekly and
 monthly reports, but suddenly all stopped (I don't receive nothing in my
 email).
 
 Can you help me?

You have had some other responses that may lead you to an answer.
Check them out.

One more wil idea of something to check is disk space.   Is it
possible that your job is trying to write to some space where there
is not enough room?   

Also, is it possible that some previous job failed, but didn't
complete terminate and is still hanging around or hanging on
to some space needed by the jobs.Sometimes just doing a reboot
will clear that up -- though it won't prevent the problem from
recurring.

Good luck,

jerry

 
 Thanks in advance
 
 Juan Coruña
 Desarrollo de Software Atlantico
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [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: cron not working till 28/08/07

2007-09-19 Thread Bill Vermillion
On Wed, Sep 19, 2007 at 21:46 , after knocking over a stack of
dishes on the heat sink [EMAIL PROTECTED]
wondered out loud about:


 Date: Wed, 19 Sep 2007 12:36:07 - (GMT)
 From: DSA - JCR [EMAIL PROTECTED]
 Subject: Cron not working till 28/08/07

 Hi all !!

 I had several crontab jobs in order to make backups.

 All worked fine till the 28-Aug-2007 when it seems to be stopped
 for some reason, I don't know why.

 I had a reporting in my mail box (external) also with daily,
 weekly and monthly reports, but suddenly all stopped (I don't
 receive nothing in my email).

 Can you help me?

I had the same problem.  It was after I did an upgrade.

I found that /etc/crontab had gotten copied somehow to
/var/cron/tabs/root.

I did get errors of 'root not found'. [or similar].

Check to see if that hasn't happened to you.

By any chance had you performed a  'crontab -e' and screwed
things up and deleted the cron.

/etc/crontab runs the daily scripts you should be getting.
Having that also in /var/cron/tabs made my daily messages go
away.

Bill

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


Re: cron jobs not done during sleep

2007-09-17 Thread Bill Moran
In response to Steve Franks [EMAIL PROTECTED]:

 Correct me if I'm wrong, but cron doesn't keep track of the last time
 something was done, does it?  Which is to say if my system is crashed,
 was asleep, or powered off when a job is supposed to happen, it will
 not happen the next time the system is successfully operational, will
 it?  It's not obvious to me for sure either way from any sources I've
 read (man crontab, google), and unix tends towards k.i.s.s. (which is
 why we like it)
 
 ...I understand why that would be important behavior if something
 would cause problems executed other than 9am on Mondays...
 
 Is there a tool or setting to implement this functionality?  I want
 something to happen weekly, I don't care when.  Assume I am off the
 commercial power grid and I'm not going to leave my system powered on
 just to make sure my backups get run.  I use it when I need it, then I
 turn it off.  More people should.  Electricity is not free from a
 economic, social, or environmental perspective, and promises to be
 less so with time.

BSD's cron doesn't have this functionality.

The Linux folks have a cron-ish program that does recognize when jobs
have been missed and runs them at the earliest opportunity.  I dislike
it, personally, but I can see where it's convenient in some circumstances.

http://anacron.sourceforge.net/

It's in ports.

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


Re: cron jobs not done during sleep

2007-09-17 Thread David Kelly
On Mon, Sep 17, 2007 at 08:22:45AM -0700, Steve Franks wrote:
 Correct me if I'm wrong, but cron doesn't keep track of the last time
 something was done, does it?  Which is to say if my system is crashed,
 was asleep, or powered off when a job is supposed to happen, it will
 not happen the next time the system is successfully operational, will
 it?  It's not obvious to me for sure either way from any sources I've
 read (man crontab, google), and unix tends towards k.i.s.s. (which is
 why we like it)
 
 ...I understand why that would be important behavior if something
 would cause problems executed other than 9am on Mondays...
 
 Is there a tool or setting to implement this functionality?  I want
 something to happen weekly, I don't care when.  Assume I am off the
 commercial power grid and I'm not going to leave my system powered on
 just to make sure my backups get run.  I use it when I need it, then I
 turn it off.  More people should.  Electricity is not free from a
 economic, social, or environmental perspective, and promises to be
 less so with time.

Is easy enough to implement yourself. Write a script containing your
weekly commands. Launch it every hour or so.

First thing in your script look for a flag file indicating last time
your script was run. If it does not exist, create it (suggest using
touch), and run the rest of your script.

If the flag file does exist compare dates. If older than some specified
interval then touch(1) it and run the rest of your script. Might get
fancy and code the date test in the crontab command field.

/var/run might be a good place to put your flag file.

Notice the test(1) utility can compare new/older file dates and that
touch(1) can stamp a future date on the file.

You can compile a future date with date -v +1W. Play with the
formatting options to make the output compatible with input to touch.

-- 
David Kelly N4HHE, [EMAIL PROTECTED]

Whom computers would destroy, they must first drive mad.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron jobs not done during sleep

2007-09-17 Thread RW
On Mon, 17 Sep 2007 08:22:45 -0700
Steve Franks [EMAIL PROTECTED] wrote:

 Is there a tool or setting to implement this functionality?  I want
 something to happen weekly, I don't care when. 

One way is to install a crontab replacement like fcron, but the easiest
way to handle this is to install anacron, which works in conjunction
with crontab. 

With anacron you need to comment out the three periodic calls
in /etc/crontab so anacron can schedule them itself - it has a
default .conf file to do this. Adding anacron_enable=yes to rc.conf
causes it to run tasks at boot-up. You should also add one or more
entries to crontab to make it run during the night.

0004 ***root/usr/local/sbin/anacron


It's actually not essential to set anacron_enable=yes I just use
crontab to run it several times a day at convenient time.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron job every 5 hours

2007-07-18 Thread RW
On Tue, 17 Jul 2007 21:53:22 -0700
Garrett Cooper [EMAIL PROTECTED] wrote:

 Shell scripts with sleep won't give you exactly the 5 hours you 
 desire, but should come close (within 1-5 seconds of actual time 
 depending on your host PC's precision, and whether or not your RTC 
 battery is dead ;)..).

I don't think the RTC battery being dead would affect sleep times. 5
hours in 1970 (or whenever) are the the same length as 5 hours now.

If you want to anything more complex than can be achieved with cron,
it's probably better to install one of the cron replacement ports,
such as fcron. I don't see any reason why one of these couldn't run
in parallel with the existing cron, or you can turn-off cron in rc.conf.

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


Re: cron job every 5 hours

2007-07-17 Thread Olivier Nicole
 Something like:
 
 minute */5 * * * root path/to/scriptname
 
 will do the trick.
 
 Substitute the * in */5 for your desired start time (* being 0).
 
 -Garrett
 
 PS crond won't do 5 hours and every x number of minutes per job (5 hours 
 + x mins from end to start), just a flat amount of time (5 hours apart 
 from start to start). If you need that type of 'precision', at will 
 solve that like Olivier said if you place it at the end of the command.

I am afraid not.

*/5 means on every hours that is a multiple of 5, not every five
 hours. So it will run every day at hour 0, 5, 10, 15 and 20. Between
 hour 20 one day and hour 0 the next day there is only 4 hours, not
 the every 5 hours requested.

Just to confirm that I launched a cron job yesterday:

23 */5 * * * /home/java/on/crontest

It ran at 15:23, 20:23 and today at 0:23 and 5:23 and so on:

Date: Wed, 18 Jul 2007 05:23:00 +0700 (ICT)
From: Olivier Nicole [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: test crontab 5 hours
X-Virus-Scanned: on CSIM by amavisd-milter (http://www.amavis.org/)

This is a test for crontab


Only way to run a job every 5 hours is with at(1).

Best regards,

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


Re: cron job every 5 hours

2007-07-17 Thread Fredrik Tolf
Olivier Nicole [EMAIL PROTECTED] writes:

 Something like:
 
 minute */5 * * * root path/to/scriptname
 
 will do the trick.
 
 Substitute the * in */5 for your desired start time (* being 0).
 
 -Garrett
 
 PS crond won't do 5 hours and every x number of minutes per job (5 hours 
 + x mins from end to start), just a flat amount of time (5 hours apart 
 from start to start). If you need that type of 'precision', at will 
 solve that like Olivier said if you place it at the end of the command.

 I am afraid not.

 */5 means on every hours that is a multiple of 5, not every five
  hours. So it will run every day at hour 0, 5, 10, 15 and 20. Between
  hour 20 one day and hour 0 the next day there is only 4 hours, not
  the every 5 hours requested.

 Just to confirm that I launched a cron job yesterday:

 23 */5 * * * /home/java/on/crontest

 It ran at 15:23, 20:23 and today at 0:23 and 5:23 and so on:

 Date: Wed, 18 Jul 2007 05:23:00 +0700 (ICT)
 From: Olivier Nicole [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: test crontab 5 hours
 X-Virus-Scanned: on CSIM by amavisd-milter (http://www.amavis.org/)

 This is a test for crontab
 [...]
 Only way to run a job every 5 hours is with at(1).

I wouldn't go as far as saying the *only* way. You could make the cron
job run every hour and then have an internal check in it (or using a
wrapper script that checks it). Kind of like this, maybe?

#!/bin/sh
unset nogo
if [ -r /tmp/lastrun ]; then
now=`date +%H`
if [ $((($now + 24 - `cat /tmp/lastrun`) % 24)) -lt 5 ]; then
nogo=y
fi
fi

if [ $nogo = y ]; then exit 0; fi

date +%H /tmp/lastrun

# Do real work here

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


Re: cron job every 5 hours

2007-07-17 Thread Garrett Cooper

Fredrik Tolf wrote:

Olivier Nicole [EMAIL PROTECTED] writes:

  

Something like:

minute */5 * * * root path/to/scriptname

will do the trick.

Substitute the * in */5 for your desired start time (* being 0).

-Garrett

PS crond won't do 5 hours and every x number of minutes per job (5 hours 
+ x mins from end to start), just a flat amount of time (5 hours apart 
from start to start). If you need that type of 'precision', at will 
solve that like Olivier said if you place it at the end of the command.
  

I am afraid not.

*/5 means on every hours that is a multiple of 5, not every five
 hours. So it will run every day at hour 0, 5, 10, 15 and 20. Between
 hour 20 one day and hour 0 the next day there is only 4 hours, not
 the every 5 hours requested.


That's what I meant _..

Just to confirm that I launched a cron job yesterday:

23 */5 * * * /home/java/on/crontest

It ran at 15:23, 20:23 and today at 0:23 and 5:23 and so on:

Date: Wed, 18 Jul 2007 05:23:00 +0700 (ICT)
From: Olivier Nicole [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: test crontab 5 hours
X-Virus-Scanned: on CSIM by amavisd-milter (http://www.amavis.org/)

This is a test for crontab
[...]
Only way to run a job every 5 hours is with at(1).



I wouldn't go as far as saying the *only* way. You could make the cron
job run every hour and then have an internal check in it (or using a
wrapper script that checks it). Kind of like this, maybe?

#!/bin/sh
unset nogo
if [ -r /tmp/lastrun ]; then
now=`date +%H`
if [ $((($now + 24 - `cat /tmp/lastrun`) % 24)) -lt 5 ]; then
nogo=y
fi
fi

if [ $nogo = y ]; then exit 0; fi

date +%H /tmp/lastrun

# Do real work here
  


   If you're going to do it that way, just try something like this:

#!/bin/sh

while [ 1 ]; do
   exec command;
   sleep 1900 # 5 hours = 5*3600;
done

   and set it up as an rc script :).

   Shell scripts with sleep won't give you exactly the 5 hours you 
desire, but should come close (within 1-5 seconds of actual time 
depending on your host PC's precision, and whether or not your RTC 
battery is dead ;)..).


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


Re: cron job every 5 hours

2007-07-17 Thread Garrett Cooper

Garrett Cooper wrote:

Fredrik Tolf wrote:

Olivier Nicole [EMAIL PROTECTED] writes:

 

Something like:

minute */5 * * * root path/to/scriptname

will do the trick.

Substitute the * in */5 for your desired start time (* being 0).

-Garrett

PS crond won't do 5 hours and every x number of minutes per job (5 
hours + x mins from end to start), just a flat amount of time (5 
hours apart from start to start). If you need that type of 
'precision', at will solve that like Olivier said if you place it 
at the end of the command.
  

I am afraid not.

*/5 means on every hours that is a multiple of 5, not every five
 hours. So it will run every day at hour 0, 5, 10, 15 and 20. Between
 hour 20 one day and hour 0 the next day there is only 4 hours, not
 the every 5 hours requested.


That's what I meant _..

Just to confirm that I launched a cron job yesterday:

23 */5 * * * /home/java/on/crontest

It ran at 15:23, 20:23 and today at 0:23 and 5:23 and so on:

Date: Wed, 18 Jul 2007 05:23:00 +0700 (ICT)
From: Olivier Nicole [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: test crontab 5 hours
X-Virus-Scanned: on CSIM by amavisd-milter (http://www.amavis.org/)

This is a test for crontab
[...]
Only way to run a job every 5 hours is with at(1).



I wouldn't go as far as saying the *only* way. You could make the cron
job run every hour and then have an internal check in it (or using a
wrapper script that checks it). Kind of like this, maybe?

#!/bin/sh
unset nogo
if [ -r /tmp/lastrun ]; then
now=`date +%H`
if [ $((($now + 24 - `cat /tmp/lastrun`) % 24)) -lt 5 ]; then
nogo=y
fi
fi

if [ $nogo = y ]; then exit 0; fi

date +%H /tmp/lastrun

# Do real work here
  


   If you're going to do it that way, just try something like this:

#!/bin/sh

while [ 1 ]; do
   exec command;
   sleep 1900 # 5 hours = 5*3600;
done

   and set it up as an rc script :).

   Shell scripts with sleep won't give you exactly the 5 hours you 
desire, but should come close (within 1-5 seconds of actual time 
depending on your host PC's precision, and whether or not your RTC 
battery is dead ;)..).


-Garrett

That should read 19000. Doh!
-Garrett

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


Re: cron job every 5 hours

2007-07-15 Thread Olivier Nicole
 I want to run an updater script, every 5 hours and x minutes. I thought 
 to use:
 
 minute 5 * * * root path/to/scriptname
 
 but that looks like it only works once a day, i want it to go every 5 hours 
 not justa at 5 in the monrning.

You could sechedule you jor at 5, 10, 15 and 20 on monday, then 1, 6,
11, 16 and 21 on Tuesday and etc, but as the number of hours per week
is not a multiple of 5, next week Monday would be at 2, 7, 12, 17 and
22, and that would not work with cron.

If you absolutely need it to be 5 hours (6 hours would work nicely
with cron) have your job restart itself with at(1).

Cron must work on a weekly sechedule.

bests,

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


Re: cron job every 5 hours

2007-07-15 Thread Garrett Cooper

Olivier Nicole wrote:
I want to run an updater script, every 5 hours and x minutes. I thought 
to use:


minute 5 * * * root path/to/scriptname

but that looks like it only works once a day, i want it to go every 5 hours 
not justa at 5 in the monrning.



You could sechedule you jor at 5, 10, 15 and 20 on monday, then 1, 6,
11, 16 and 21 on Tuesday and etc, but as the number of hours per week
is not a multiple of 5, next week Monday would be at 2, 7, 12, 17 and
22, and that would not work with cron.

If you absolutely need it to be 5 hours (6 hours would work nicely
with cron) have your job restart itself with at(1).

Cron must work on a weekly sechedule.

bests,

Olivier

   Something like:

   minute */5 * * * root path/to/scriptname

   will do the trick.

   Substitute the * in */5 for your desired start time (* being 0).

-Garrett

PS crond won't do 5 hours and every x number of minutes per job (5 hours 
+ x mins from end to start), just a flat amount of time (5 hours apart 
from start to start). If you need that type of 'precision', at will 
solve that like Olivier said if you place it at the end of the command.

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


Re: cron job every 5 hours

2007-07-13 Thread Duane Hill

On Fri, 13 Jul 2007 at 12:50 -0400, [EMAIL PROTECTED] confabulated:


Hello,
  I want to run an updater script, every 5 hours and x minutes. I thought to 
use:


minute 5 * * * root path/to/scriptname


crontab(5):
  ...
  Steps are also permitted after an asterisk, so if you want to say
  ``every two hours'', just use ``*/2''.
  ...

So, my guess would be:

minute */5 * * * root path/to/scriptname

but that looks like it only works once a day, i want it to go every 5 hours 
not justa at 5 in the monrning.

Thanks.
Dave.


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


Re: cron job every 5 hours

2007-07-13 Thread Josh Paetzel
On Friday 13 July 2007, Duane Hill wrote:
 On Fri, 13 Jul 2007 at 12:50 -0400, [EMAIL PROTECTED] 
confabulated:
  Hello,
I want to run an updater script, every 5 hours and x minutes. I
  thought to use:
 
  minute 5 * * * root path/to/scriptname

 crontab(5):
...
Steps are also permitted after an asterisk, so if you want to
 say ``every two hours'', just use ``*/2''.
...

 So, my guess would be:

 minute */5 * * * root path/to/scriptname


Sort of, that would run the cronjob at midnight, 5am, 10am, 3pm, and 
8pm so there would be one interval where it runs at 4 hours.

The real method if it's imparitive to run it every 5 hours would be to 
set up a cronjob for each day of the week, rotating by one hour.

minute 0,5,10,15,20 * * 0
minute 1,6,11,16,21 * * 1
minute 2,7,12,17,22 * * 2
and so on and so forth


-- 
Thanks,

Josh Paetzel


pgpKypBoJsPIw.pgp
Description: PGP signature


Re: cron mystery

2007-02-26 Thread Chuck Swiger

Robin Becker wrote:
[ ... ]

before
##
SHELL=/bin/sh
MAILTO=user

13 3 * * *  $HOME/bin/daily
19 * * * *  $HOME/bin/hourly


after
##
SHELL=/bin/sh
MAILTO=user

13 3 * * *  /home/user/bin/daily
41 * * * *  /home/user/bin/hourly


and at 41 past the hour the hourly job came back.

Is it the HOME variable or the act of rewriting? User did have home 
defined in /etc/passwd.


I suspect that $HOME isn't being defined as one might expect-- cron provides a 
very minimal shell environment for scripts it runs.


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


Re: cron mystery

2007-02-26 Thread Robin Becker

Chuck Swiger wrote:

Robin Becker wrote:
[ ... ]

before
##
SHELL=/bin/sh
MAILTO=user

13 3 * * *  $HOME/bin/daily
19 * * * *  $HOME/bin/hourly


after
##
SHELL=/bin/sh
MAILTO=user

13 3 * * *  /home/user/bin/daily
41 * * * *  /home/user/bin/hourly


and at 41 past the hour the hourly job came back.

Is it the HOME variable or the act of rewriting? User did have home 
defined in /etc/passwd.


I suspect that $HOME isn't being defined as one might expect-- cron 
provides a very minimal shell environment for scripts it runs.


except that I have exactly the same script running on another box with the same 
freeBSD version and that runs things fine. Looking in man 5 crontab seems to 
suggest that SHELL=/bin/sh  HOME, LOGNAME are set from the user passwd entry.

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


Re: cron mystery

2007-02-26 Thread Derek Ragona
Environment variables are set first by the users shell which then is used 
to exec cron jobs.  Basically, always take nothing in the environment for 
granted.


-Derek


At 10:19 AM 2/26/2007, Robin Becker wrote:
Can anyone think of something that can stop cron working for a particular 
user?
I just noticed on one of our 6.1 machines the crontab for a particular 
user wasn't run properly since dec 21. There were hourly and daily jobs, 
but neither seemed to be running.


Looked in var/cron and see no deny or allow files. The user x had an 
proper crontab.


In the end I modified the users crontab and rewrote it

before
##
SHELL=/bin/sh
MAILTO=user

13 3 * * *  $HOME/bin/daily
19 * * * *  $HOME/bin/hourly


after
##
SHELL=/bin/sh
MAILTO=user

13 3 * * *  /home/user/bin/daily
41 * * * *  /home/user/bin/hourly


and at 41 past the hour the hourly job came back.

Is it the HOME variable or the act of rewriting? User did have home 
defined in /etc/passwd.

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

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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


Re: cron problem

2007-01-30 Thread Oliver Koch
Hi,

Charlie McElfresh schrieb:

 I wrote a perl script to get a news show I like.  When I run it, it deletes
 yesterday's copy of the show, and downloads the new copy.  The script works
 fine.  I run the script as myself (charlie), charlie owns it, and it's
 chmod'd 0755.  Works fine.
 
 I can't get cron to run it, though.  Here's the cron process running on my
 machine:
 
 [EMAIL PROTECTED] ps auxwww | grep cron
 root  413  0.0  0.1  1364   892  ??  Ss5Jan07  
 0:06.57/usr/sbin/cron -s
 
 And here's charlie's crontab, to run at 7:17 mon - fri
 
 17 7 * * 1-5 /media/democracy_now/get_new_show.pl

did you try to change the cronjob to something like that?

17 7 * * 1-5 /usr/bin/perl /media/democracy_now/get_new_show.pl

Kind regards,

Oliver

-- 
Oliver Koch  Phone:  +49-(0)5323-72-2626
Computer Center  Fax:+49-(0)5323-72-3536
Clausthal University of Technology   E-Mail: [EMAIL PROTECTED]
Erzstraße 51 Web:  http://www.rz.tu-clausthal.de
38678 Clausthal-Zellerfeld, Germany



signature.asc
Description: OpenPGP digital signature


Re: cron problem

2007-01-30 Thread Gerard Seibert
On Tuesday January 30, 2007 at 02:13:45 (PM) Charlie McElfresh wrote:


 I wrote a perl script to get a news show I like.  When I run it, it deletes
 yesterday's copy of the show, and downloads the new copy.  The script works
 fine.  I run the script as myself (charlie), charlie owns it, and it's
 chmod'd 0755.  Works fine.
 
 I can't get cron to run it, though.  Here's the cron process running on my
 machine:
 
 [EMAIL PROTECTED] ps auxwww | grep cron
 root  413  0.0  0.1  1364   892  ??  Ss5Jan07   0:06.57/usr/sbin/cron 
 -s
 
 And here's charlie's crontab, to run at 7:17 mon - fri
 
 17 7 * * 1-5 /media/democracy_now/get_new_show.pl

Do you have a MAILTO= in your cron. If not, I would suggest you put one
there that points to you, i.e., if charlie is your logon name, have it
point to charlie. Now, when your script either works or fails, you will
receive a report of what transpired.

-- 
Gerard

 Mail from '@gmail' is rejected and/or discarded here. Don't waste
 your time!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: CRON Script not working right.

2007-01-17 Thread Derek Ragona
Always use full pathnames to commands in cron scripts.  Change the lines to 
include the full paths for chown and chmod.


-Derek


At 09:31 PM 1/16/2007, Don O'Neil wrote:

Anybody have any clues why a shell script run from root's CRON would act
differently then when run directly from the command line?

Specifically, I have a script that looks for files on a NFS mount point and
copies them across and changes the ownership/perms.

Here's the gist of the script:

#!/bin/sh
TDIR=`date +%m%d%y%s`
mkdir /tmp/$TDIR
mv /source/* /tmp/$TDIR/
chown user:group /tmp/$TDIR/*
chmod 660 /tmp/$TDIR/*
mv /tmp/$TDIR/* /destination/

When run from roots CRON it does everything but the chmod correctly, which
is strange. When I run it from the command line as root it works fine as
expected.

I'm running 6.1-STABLE-200608.

Any clues?

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

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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


Re: CRON Script not working right.

2007-01-16 Thread Bill Campbell
On Tue, Jan 16, 2007, Don O'Neil wrote:
Anybody have any clues why a shell script run from root's CRON would act
differently then when run directly from the command line?

Most often this is because the environment in the cron job is
different, either missing variables or having variables that
aren't set to a reasonable value (e.g. TERM).

The way I usually figure something like this out is to dump the
envioronment from the cron job, then do the same thing from the
command line, then compare the two.

#!/bin/sh
# this is the cron job
env | sort  /tmp/env.cron
exit;

Now from the command line ``env | sort  /tmp/cron.cli''.

Now run something like ``diff -u /tmp/env.cron /tmp/cron.cli'' to
see what is different.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

When a place gets crowded enough to require ID's, social collapse is
not far away.  It is time to go elsewhere.  The best thing about space
travel is that it made it possible to go elsewhere.
-- Robert Heinlein
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron not running

2007-01-01 Thread Annelise Anderson

On Thu, 28 Dec 2006, steve wrote:

It has been a long time since I've had to post for help, so forgive me if 
this question is misplaced or stupid. 
I have a freebsd server running at home now for years with no problems.  Over 
the  years it has been rebooted a few times either on purpose or do to things 
like power failures.  It has always started up without problems.  On the 
12/27 I shut down the server so I could physically clean the server (was 
getting kinda gross with dust balls and stuff).  It started up no problems 
but rather curiously the cron service does not seem to be processing any jobs 
now. 
I am not sure where to go about figuring out what the problem is or how to 
fix it.  I would greatly appreciate any help or guidance from people here on 
this issue. 
Steve

www.digitalbluesky.net ___


You can use the ps command to find out if cron is running:

ps aux | grep cron

It should show you /usr/sbin/cron

cron is started with defaults in /etc/defaults/rc.conf as modified by
/etc/rc.conf.

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


Re: cron not running

2006-12-28 Thread Derek Ragona
Check the clock.  Often older systems have dead batteries so the clock is 
so far out of whack cron jobs don't run.


-Derek


At 08:18 AM 12/28/2006, steve wrote:
It has been a long time since I've had to post for help, so forgive me if 
this question is misplaced or stupid.

I have a freebsd server running at home now for years with no problems.
Over the  years it has been rebooted a few times either on purpose or do 
to things like power failures.  It has always started up without 
problems.  On the 12/27 I shut down the server so I could physically clean 
the server (was getting kinda gross with dust balls and stuff).  It 
started up no problems but rather curiously the cron service does not seem 
to be processing any jobs now.
I am not sure where to go about figuring out what the problem is or how to 
fix it.  I would greatly appreciate any help or guidance from people here 
on this issue.

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

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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


Re: cron not running

2006-12-28 Thread Roger Olofsson

Hello,

Make sure to use full path in the cron command file, like so:

/usr/sbin/ntpdate time.server.anywhere



Derek Ragona skrev:
Check the clock.  Often older systems have dead batteries so the clock 
is so far out of whack cron jobs don't run.


-Derek


At 08:18 AM 12/28/2006, steve wrote:
It has been a long time since I've had to post for help, so forgive me 
if this question is misplaced or stupid.

I have a freebsd server running at home now for years with no problems.
Over the  years it has been rebooted a few times either on purpose or 
do to things like power failures.  It has always started up without 
problems.  On the 12/27 I shut down the server so I could physically 
clean the server (was getting kinda gross with dust balls and stuff).  
It started up no problems but rather curiously the cron service does 
not seem to be processing any jobs now.
I am not sure where to go about figuring out what the problem is or 
how to fix it.  I would greatly appreciate any help or guidance from 
people here on this issue.

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


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.




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


Re: cron not running

2006-12-28 Thread James Riendeau
You might want to use ntpd to sync the clock before cron starts if  
this turns out to be your problem:


http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network- 
ntp.html


Once you have ntpd working, just put ntpd on the require line in the  
cron startup file,  /etc/rc.d/cron, to ensure that cron starts up  
after ntpd.


...or just buy a new motherboard battery.


James Riendeau
MMI Computer Support Technician
1300 University Ave
Rm. 436, Dept. of MedMicro
Madison, WI  53706

Phone: (608) 262-3351
After-hours Phone: (608) 260-2696
Fax: (608) 262-8418
Email: [EMAIL PROTECTED]



On Dec 28, 2006, at 3:33 PM, [EMAIL PROTECTED]  
wrote:


Date: Thu, 28 Dec 2006 09:07:23 -0600
From: Derek Ragona [EMAIL PROTECTED]
Subject: Re: cron not running
To: steve [EMAIL PROTECTED],
freebsd-questions@freebsd.org freebsd-questions@freebsd.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii; format=flowed

Check the clock.  Often older systems have dead batteries so the  
clock is

so far out of whack cron jobs don't run.

 -Derek


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


Re: Cron [EMAIL PROTECTED] /usr/libexec/save-entropy

2006-09-22 Thread Martin McCormick
Martin McCormick writes:
 I must have dome something wrong setting up a FreeBSD5.4
 system, but I haven't a clue as to what.

This is still Martin McCormick.  I haven't found exactly
what I did yet, but I remembered that I do have a second 5.4 box
and it appears to be fine so I can probably solve this after some
digging.  Sorry to waste anybody's time.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cron [EMAIL PROTECTED] /usr/libexec/save-entropy

2006-09-22 Thread Bernd Trippel

Quoting Martin McCormick [EMAIL PROTECTED]:


I must have dome something wrong setting up a FreeBSD5.4
system, but I haven't a clue as to what.

The script is called save-entropy, a great idea, but it
acts as if lots of the configuration it needs is missing.  I do
have ipfw running and it got all the rules I put in to it via a
rule-setting script called in rc.conf.local but the message that
cron generates every eleven minutes shows that something is very
unhappy.

For now, I simply commented out the save-entropy run for
a bit of peace and quiet, but the entropy is now not being
updated which is not a good thing.

What do I need to look at to fix this properly?

Thank you.

Martin McCormick WB5AGZ  Stillwater, OK
Systems Engineer
OSU Information Technology Department Network Operations Group

--- Forwarded Message


Date:Fri, 22 Sep 2006 08:55:00 CDT

From:[EMAIL PROTECTED] (Cron Daemon)
Subject: Cron [EMAIL PROTECTED] /usr/libexec/save-entropy


ipfw: not found

That repeats 15 more times.


--- End of Forwarded Message




Seems you have a line containing only ipfw in your rc.conf.
Comment it out or remove it. save-entropy relies on files specified in 
rc.conf.



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


Re: cron job limits

2006-06-13 Thread Chuck Swiger

Jim Pazarena wrote:

I have a fairly lengthy routine which runs each
Sunday morning in a cronjob. For many months
now it has never completed, and I have to manually
run it from the CLI. (which runs fine). The cronjob
runs as root.

It isn't failing because of a PATH problem,
(it's just /usr/local/bin/analog running in dozens
of repetitions)

/usr/bin/limits shows most limits as infinity

I don't get any email error message .. nothing! it just quits!

any ideas?


Add echo statements to the job, or change it to being a shell script that cron 
calls, which then runs all of your analog processes there.  Make sure that 
MAILTO is set.  If necessary, add a cronjob for /bin/false to check.  :-)


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


Re: cron job limits

2006-06-13 Thread Derek Ragona
Is your shell different from the account running the cron job?  Is there 
any other jobs that might kill this cron job?


Add echo statements to your script and save a log file.  Be sure to 
redirect stderr as well as stdout to the log file.


-Derek

At 10:34 AM 6/13/2006, Jim Pazarena wrote:

I have a fairly lengthy routine which runs each
Sunday morning in a cronjob. For many months
now it has never completed, and I have to manually
run it from the CLI. (which runs fine). The cronjob
runs as root.

It isn't failing because of a PATH problem,
(it's just /usr/local/bin/analog running in dozens
of repetitions)

/usr/bin/limits shows most limits as infinity

I don't get any email error message .. nothing! it just quits!

any ideas?

Thanks


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

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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


Re: cron job errors

2006-05-24 Thread Mark Busby
Mark Busby [EMAIL PROTECTED] writes:
   I getting errors from cron on this job.
   owner of /usr/libexec/sav-entropy is root:wheel

   email notice:
   Subject: Cron [EMAIL PROTECTED] /usr/libexec/save-entropy
 X-Cron-Env: SHELL=/bin/sh
 X-Cron-Env: PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
 X-Cron-Env: HOME=/
 X-Cron-Env: LOGNAME=operator
 X-Cron-Env: USER=operator
   add: not found

   crontab entry:
   # Save some entropy so that /dev/random can re-seed on boot.
 */11*   *   *   *   operator /usr/libexec/save-entropy
  Did you update your system lately?
Compare the script to its source:
 diff -q /usr/src/libexec/save-entropy/save-entropy.sh 
/usr/libexec/save-entropy

Yes I did update to 6.1, running diff on the files shows no problems there.
   
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: cron job errors

2006-05-23 Thread Lowell Gilbert
Mark Busby [EMAIL PROTECTED] writes:

 I getting errors from cron on this job. 
   owner of /usr/libexec/sav-entropy is root:wheel

   email notice:
   Subject: Cron [EMAIL PROTECTED] /usr/libexec/save-entropy
 X-Cron-Env: SHELL=/bin/sh
 X-Cron-Env: PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
 X-Cron-Env: HOME=/
 X-Cron-Env: LOGNAME=operator
 X-Cron-Env: USER=operator
   add: not found

   crontab entry:
   # Save some entropy so that /dev/random can re-seed on boot.
 */11*   *   *   *   operator /usr/libexec/save-entropy

Did you update your system lately?
Compare the script to its source:
 diff -q /usr/src/libexec/save-entropy/save-entropy.sh 
/usr/libexec/save-entropy
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


  1   2   3   >