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


Cron Not Sending Mail

2009-03-01 Thread APseudoUtopia
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
___
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: Running rsnapshot via cron reboots the machine

2008-12-18 Thread Mel
On Wednesday 17 December 2008 11:40:00 David N wrote:
 2008/12/17 Mel fbsd.questi...@rachie.is-a-geek.net:
  On Monday 15 December 2008 18:56:46 David N wrote:
  Hi,
 
  I have a machine
  AMD Sepron LE-1150
  ASUS M2A-VM
  1GB RAM ECC
  2x SATA 300GB
 
  in a RAID 1 (gmirror).
  7.0-RELEASE-p2 AMD64 generic kernel
 
  it was doing backups via bacula to an external disk
  USB 2.0 SATA disk, and it was working well. (GLabel) /dev/ufs/BackupDisk
 
  I changed to rsnapshot recently, with the External HDD in glabel +
  gjournal (/dev/da0s1.journal - /dev/ufs/BackupDisk) and it will
  reboot the machine roughly 30 minutes after the rsnapshot starts via
  CRON.
 
  Able to get any crash dumps? [1] I doubt it calls reboot system call
  after 30 minutes and if it's a heating issue, then it would power down
  not reboot. So, kernel is probably panicing.
 
  [1]
  http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/kern
 eldebug.html
 
  --
  Mel
 
  Problem with today's modular software: they start with the modules
 and never get to the software part.

 I found something in the vmcore.0

 panic: Journal overflow (joffset=499758276096 active=498475869184
 inactive=499755984896)
 cpuid = 0
 Uptime: 16h7m11s

 I tried kgdb on on the vmcore but it didn't work, I had -p2 installed,
 but compiled p6 so it might of overwrittin things in /usr/obj

 [GDB will not be able to debug user-mode threads:
 /usr/lib/libthread_db.so: Undefined symbol ps_pglobal_lookup]
 GNU gdb 6.1.1 [FreeBSD]
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are welcome to change it and/or distribute copies of it under certain
 conditions. Type show copying to see the conditions.
 There is absolutely no warranty for GDB.  Type show warranty for details.
 This GDB was configured as amd64-marcel-freebsd.
 Cannot access memory at address 0x0


 The journal was set to 2GB on the 400GB USB attached disk. (/dev/da0)

 I just formatted the disk without gjournal and see how that goes. I
 guess i can't use gjournal over USB? I have gjournal running on
 another server (gmirror + gjournal) and i thrash it pretty hard
 without any problems.

It should not panic, but a journal overflow is more likely with USB, cause of 
the lower write speed (the journal fills faster then it's being emptied). 
Your best bet is to reproduce the panic using the sources that match the 
kernel and file a PR and/or post to freebsd-fs list to find out if there are 
people with similar problems/usage cases. It could be a tunable that you 
missed or that it's a known issue.

-- 
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: Running rsnapshot via cron reboots the machine

2008-12-18 Thread David N
2008/12/18 Mel fbsd.questi...@rachie.is-a-geek.net:
 On Wednesday 17 December 2008 11:40:00 David N wrote:
 2008/12/17 Mel fbsd.questi...@rachie.is-a-geek.net:
  On Monday 15 December 2008 18:56:46 David N wrote:
  Hi,
 
  I have a machine
  AMD Sepron LE-1150
  ASUS M2A-VM
  1GB RAM ECC
  2x SATA 300GB
 
  in a RAID 1 (gmirror).
  7.0-RELEASE-p2 AMD64 generic kernel
 
  it was doing backups via bacula to an external disk
  USB 2.0 SATA disk, and it was working well. (GLabel) /dev/ufs/BackupDisk
 
  I changed to rsnapshot recently, with the External HDD in glabel +
  gjournal (/dev/da0s1.journal - /dev/ufs/BackupDisk) and it will
  reboot the machine roughly 30 minutes after the rsnapshot starts via
  CRON.
 
  Able to get any crash dumps? [1] I doubt it calls reboot system call
  after 30 minutes and if it's a heating issue, then it would power down
  not reboot. So, kernel is probably panicing.
 
  [1]
  http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/kern
 eldebug.html
 
  --
  Mel
 
  Problem with today's modular software: they start with the modules
 and never get to the software part.

 I found something in the vmcore.0

 panic: Journal overflow (joffset=499758276096 active=498475869184
 inactive=499755984896)
 cpuid = 0
 Uptime: 16h7m11s

 I tried kgdb on on the vmcore but it didn't work, I had -p2 installed,
 but compiled p6 so it might of overwrittin things in /usr/obj

 [GDB will not be able to debug user-mode threads:
 /usr/lib/libthread_db.so: Undefined symbol ps_pglobal_lookup]
 GNU gdb 6.1.1 [FreeBSD]
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are welcome to change it and/or distribute copies of it under certain
 conditions. Type show copying to see the conditions.
 There is absolutely no warranty for GDB.  Type show warranty for details.
 This GDB was configured as amd64-marcel-freebsd.
 Cannot access memory at address 0x0


 The journal was set to 2GB on the 400GB USB attached disk. (/dev/da0)

 I just formatted the disk without gjournal and see how that goes. I
 guess i can't use gjournal over USB? I have gjournal running on
 another server (gmirror + gjournal) and i thrash it pretty hard
 without any problems.

 It should not panic, but a journal overflow is more likely with USB, cause of
 the lower write speed (the journal fills faster then it's being emptied).
 Your best bet is to reproduce the panic using the sources that match the
 kernel and file a PR and/or post to freebsd-fs list to find out if there are
 people with similar problems/usage cases. It could be a tunable that you
 missed or that it's a known issue.

 --
 Mel

 Problem with today's modular software: they start with the modules
and never get to the software part.


There are people with similar problems already reported.
http://www.freebsd.org/cgi/query-pr.cgi?pr=127420

I tried the tunables
kern.geom.journal.force_switch=50
kern.geom.journal.cache.switch=75
which made it crash even faster, in a few minutes and even corrupted
the journal. I would test it out more, but its a production server
which needs to be up and running.

At the moment its just UFS+glabel, I'll try again when 7.1 comes out.

Thank you for your help.

Regards
David N
___
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: Running rsnapshot via cron reboots the machine

2008-12-17 Thread Mel
On Monday 15 December 2008 18:56:46 David N wrote:
 Hi,

 I have a machine
 AMD Sepron LE-1150
 ASUS M2A-VM
 1GB RAM ECC
 2x SATA 300GB

 in a RAID 1 (gmirror).
 7.0-RELEASE-p2 AMD64 generic kernel

 it was doing backups via bacula to an external disk
 USB 2.0 SATA disk, and it was working well. (GLabel) /dev/ufs/BackupDisk

 I changed to rsnapshot recently, with the External HDD in glabel +
 gjournal (/dev/da0s1.journal - /dev/ufs/BackupDisk) and it will
 reboot the machine roughly 30 minutes after the rsnapshot starts via
 CRON.

Able to get any crash dumps? [1] I doubt it calls reboot system call after 30 
minutes and if it's a heating issue, then it would power down not reboot. So, 
kernel is probably panicing.

[1] 
http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/kerneldebug.html

-- 
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: Running rsnapshot via cron reboots the machine

2008-12-17 Thread David N
2008/12/17 Mel fbsd.questi...@rachie.is-a-geek.net:
 On Monday 15 December 2008 18:56:46 David N wrote:
 Hi,

 I have a machine
 AMD Sepron LE-1150
 ASUS M2A-VM
 1GB RAM ECC
 2x SATA 300GB

 in a RAID 1 (gmirror).
 7.0-RELEASE-p2 AMD64 generic kernel

 it was doing backups via bacula to an external disk
 USB 2.0 SATA disk, and it was working well. (GLabel) /dev/ufs/BackupDisk

 I changed to rsnapshot recently, with the External HDD in glabel +
 gjournal (/dev/da0s1.journal - /dev/ufs/BackupDisk) and it will
 reboot the machine roughly 30 minutes after the rsnapshot starts via
 CRON.

 Able to get any crash dumps? [1] I doubt it calls reboot system call after 30
 minutes and if it's a heating issue, then it would power down not reboot. So,
 kernel is probably panicing.

 [1]
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/kerneldebug.html

 --
 Mel

 Problem with today's modular software: they start with the modules
and never get to the software part.

I found something in the vmcore.0

panic: Journal overflow (joffset=499758276096 active=498475869184
inactive=499755984896)
cpuid = 0
Uptime: 16h7m11s

I tried kgdb on on the vmcore but it didn't work, I had -p2 installed,
but compiled p6 so it might of overwrittin things in /usr/obj

[GDB will not be able to debug user-mode threads:
/usr/lib/libthread_db.so: Undefined symbol ps_pglobal_lookup]
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as amd64-marcel-freebsd.
Cannot access memory at address 0x0


The journal was set to 2GB on the 400GB USB attached disk. (/dev/da0)

I just formatted the disk without gjournal and see how that goes. I
guess i can't use gjournal over USB? I have gjournal running on
another server (gmirror + gjournal) and i thrash it pretty hard
without any problems.

Has any new patches for gjournal been included in 7.1?

Thanks for the help
David N
___
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


Running rsnapshot via cron reboots the machine

2008-12-15 Thread David N
Hi,

I have a machine
AMD Sepron LE-1150
ASUS M2A-VM
1GB RAM ECC
2x SATA 300GB

in a RAID 1 (gmirror).
7.0-RELEASE-p2 AMD64 generic kernel

it was doing backups via bacula to an external disk
USB 2.0 SATA disk, and it was working well. (GLabel) /dev/ufs/BackupDisk

I changed to rsnapshot recently, with the External HDD in glabel +
gjournal (/dev/da0s1.journal - /dev/ufs/BackupDisk) and it will
reboot the machine roughly 30 minutes after the rsnapshot starts via
CRON.

If i run rsnapshot without CRON, eg. via the command line it works
fine. (I'm compiling the new kernel p6 whilst doing an rsnapshot via
the command line)

I have changed the time it does the rsnapshot, from 3AM (reboots at
3:30-3:40AM roughly) to 4:30AM (reboots at 5AM roughly). So its
nothing running on the system doing it. If i remove the rsnapshot from
the CRON, the computer stays on and doesn't reboot.

Its not the power supply, and the computer is on a UPS and the UPS log
hasn't reported any blackouts. (There are 2 other servers that doesn't
turn off so its not a blackout).

I left gstat and top running

 L(q)  ops/sr/s   kBps   ms/rw/s   kBps   ms/w   %busy Name
   0  0  0  00.0  0  00.00.0| acd0
   0125125   41645.5  0  00.0   29.9| ad4
   0  0  0  00.0  0  00.00.0| ad4s1
   0  0  0  00.0  0  00.00.0| ad4s2
   0125125   41645.6  0  00.0   30.5| ad4s3
  34142 71   90799.4 71   8697  212.0   99.3| da0
  34142 71   90799.6 71   8697  213.5   99.3| da0s1
   0  0  0  00.0  0  00.00.0| da0s1c
   7135 71   90799.7 64   8184   33.0   85.1| da0s1.journal
   0125125   41649.2  0  00.0   39.8| ad6
   7135 71   90799.7 64   8184   36.2   91.9| ufs/BackupDisk
   0  0  0  00.0  0  00.00.0| ad6s1
   0  0  0  00.0  0  00.00.0| ad6s2
   0125125   41649.3  0  00.0   40.4| ad6s3
   0  0  0  00.0  0  00.00.0| mirror/gm0s1
   0  0  0  00.0  0  00.00.0| mirror/gm0s2
   0125125   83289.9  0  00.0   43.9| mirror/gm0s3
   0  0  0  00.0  0  00.00.0| mirror/gm0s1a
   0  0  0  00.0  0  00.00.0| mirror/gm0s1b
   0  0  0  00.0  0  00.00.0| mirror/gm0s1c
   0  0  0  00.0  0  00.00.0| mirror/gm0s1d
   0  0  0  00.0  0  00.00.0| mirror/gm0s2c
   0  0  0  00.0  0  00.00.0| mirror/gm0s2d
   0  0  0  00.0  0  00.00.0| mirror/gm0s3c
   0125125   8328   10.2  0  00.0   45.2| mirror/gm0s3d


last pid: 18829;  load averages:  0.29,  0.45,  0.50
 up 1+01:31:23  05:01:50
64 processes:  1 running, 63 sleeping
CPU states: 16.5% user,  0.0% nice, 25.2% system,  3.0% interrupt, 55.3% idle
Mem: 69M Active, 436M Inact, 395M Wired, 44M Cache, 108M Buf, 3944K Free
Swap: 2048M Total, 308K Used, 2048M Free

 PID USERNAME  THR PRI NICE   SIZERES STATETIME   WCPU COMMAND
18634 root1  -40 15224K  2244K getblk   0:45  9.47% rsync
18633 root1  980 18296K  4576K select   0:45  4.69% rsync
18375 root1   80 20556K  8412K wait 7:20  0.00% perl
 4447 root1 -640  7656K  2036K RUN  1:21  0.00% top
 4321 root1   80 11784K  2008K nanslp   0:45  0.00% gstat
18627 root1  960 15224K  2596K select   0:36  0.00% rsync
 4219 evxadmin1  960 32936K  3220K select   0:07  0.00% sshd
 3800 evxadmin1  960 32936K  3164K select   0:06  0.00% sshd
18629 root1  960 32868K  3964K select   0:04  0.00% sshd
18628 root1  960 23764K  7664K select   0:04  0.00% ssh
 851 root1  960 12476K  1832K select   0:04  0.00% nmbd
 1788 root1  960 10576K  2812K select   0:02  0.00% sendmail
 1147 root1  960 24456K  2404K select   0:01  0.00% nmbd
 1346 root1  960 4K  2504K select   0:01  0.00% nmbd
 3957 evxadmin1  960 32936K  3220K select   0:01  0.00% sshd
 1800 root1   80  5736K  1032K nanslp   0:01  0.00% cron
 1754 root1   80  5736K   980K nanslp   0:00  0.00% cron
 1557 root1   80  5736K   980K nanslp   0:00  0.00% cron
 1387 root1   80  5736K   980K nanslp   0:00  0.00% cron
 1192 root1   80  5736K   980K nanslp   0:00  0.00% cron
 4646 root1  960 36968K  4892K select   0:00  0.00% smbd
 775 root1  960  4684K  1064K select   0:00  0.00% syslogd


Nothing else seems to be running.

Its driving me insane! any help would be appreciated. smart says the
HDD are fine

Re: Running cron jobs as nobody

2008-10-07 Thread DAve

Mel wrote:

On Thursday 02 October 2008 17:11:52 DAve wrote:

Good morning all,

We have a cronjob we need to run as nobody from /etc/crontab and it
seems to be not working. The job runs, but not as user nobody.

I noticed two things,

1) the job to update the locate DB runs as nobody, because the script
uses su to become nobody.
echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3

 ^^^
-fm: Bypass .cshrc and only change user, use root env.


Is setting the user to nobody in /etc/crontab not possible?


pw showuser operator
pw showuser nobody

Spot the difference (hint: /nonexistent)



That was my first thought as well. After reading some of the responses I 
still thought it odd that cron would not run the script as nobody. So 
I setup two scripts to dump the env vars into a file, one script runs 
from /etc/crontab and one from nobody's crontab. Both are functioning 
perfectly. I have told the developer to re investigate his script and 
his directory perms. I looks like a case of PEBKAC to me.


Thanks for the responses.

DAve


--
Don't tell me I'm driving the cart!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Running cron jobs as nobody

2008-10-05 Thread Mel
On Thursday 02 October 2008 17:11:52 DAve wrote:
 Good morning all,

 We have a cronjob we need to run as nobody from /etc/crontab and it
 seems to be not working. The job runs, but not as user nobody.

 I noticed two things,

 1) the job to update the locate DB runs as nobody, because the script
 uses su to become nobody.
 echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3
 ^^^
-fm: Bypass .cshrc and only change user, use root env.

 Is setting the user to nobody in /etc/crontab not possible?

pw showuser operator
pw showuser nobody

Spot the difference (hint: /nonexistent)

-- 
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 [EMAIL PROTECTED]


Re: Running cron jobs as nobody

2008-10-03 Thread Derek Ragona

At 10:11 AM 10/2/2008, DAve wrote:

Good morning all,

We have a cronjob we need to run as nobody from /etc/crontab and it seems 
to be not working. The job runs, but not as user nobody.


I noticed two things,

1) the job to update the locate DB runs as nobody, because the script uses 
su to become nobody.

echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3

2) nobody, as expected, has no shell or home dir in /etc/password.

I searched around for an answer but didn't see anything concerning this 
other than a patch to cron to check if setuid fails.


Is setting the user to nobody in /etc/crontab not possible?

Thanks,

DAve


I've done this two different ways:
One is to use sudo and have your script su -  to nobody.  You will need to 
test your script first before trying it through cron.


Create a cronjob for nobody using:
crontab -e -u nobody

Hope this helps.

-Derek 
--

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]


Running cron jobs as nobody

2008-10-02 Thread DAve

Good morning all,

We have a cronjob we need to run as nobody from /etc/crontab and it 
seems to be not working. The job runs, but not as user nobody.


I noticed two things,

1) the job to update the locate DB runs as nobody, because the script 
uses su to become nobody.

echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3

2) nobody, as expected, has no shell or home dir in /etc/password.

I searched around for an answer but didn't see anything concerning this 
other than a patch to cron to check if setuid fails.


Is setting the user to nobody in /etc/crontab not possible?

Thanks,

DAve

--
Don't tell me I'm driving the cart!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Running cron jobs as nobody

2008-10-02 Thread Bill Campbell
You can use ``su -c '/path/to/command' username'' to run scripts as
users other than root.

Another way is to use ``crontab -u username''.  man crontab for
details.

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

Of all the contrivances devised for cheating the laboring classes of
mankind, none has been more effective than that which deludes him with
paper money. -- -Daniel Webster
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Running cron jobs as nobody

2008-10-02 Thread DAve

Bill Campbell wrote:

You can use ``su -c '/path/to/command' username'' to run scripts as
users other than root.

Another way is to use ``crontab -u username''.  man crontab for
details.

Bill


I am being told the developer tried a user crontab without success. I've 
not suggested they try su yet though I dropped hints.


Still seems odd that setting the user to nobody in /etc/crontab did not 
work.


Dave

--
Don't tell me I'm driving the cart!
___
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-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]


portsnap in cron and firewall

2008-09-05 Thread Albert Shih
Hi all

I've some servers for internal use. On those servers I have some pf (or
ipfw) rule to deny any connection from inside to outside. 

Long time ago when ports tree is update with cvs, I'm using something like

pf command to open inside -- outside connection
cvsup 
portupgrade --fetch-only --all
pf command to close inside -- outside connection

But now with portsnap cron (that's mean random sleep) I don't known when
the system try to connect outside. 

Do you have any idea how can I make my update using portsnap (I known I can
use cvsup) in a crontab with my network config ? 

Regards.

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


RE: portsnap in cron and firewall

2008-09-05 Thread Sean Cavanaugh


 Date: Fri, 5 Sep 2008 16:14:02 +0200 From: [EMAIL PROTECTED] To: 
 freebsd-questions@freebsd.org Subject: portsnap in cron and firewall  Hi 
 all  I've some servers for internal use. On those servers I have some pf 
 (or ipfw) rule to deny any connection from inside to outside.   Long time 
 ago when ports tree is update with cvs, I'm using something like  pf 
 command to open inside -- outside connection cvsup  portupgrade 
 --fetch-only --all pf command to close inside -- outside connection  But 
 now with portsnap cron (that's mean random sleep) I don't known when the 
 system try to connect outside.   Do you have any idea how can I make my 
 update using portsnap (I known I can use cvsup) in a crontab with my network 
 config ?  
 
portsnap cron just randomizes the time to download unlike portsnap fetch 
which says to do it right now. cron was added to help randomize the time so 
everyone syncing at midnight UTC arent all hitting at exact same 
time.___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: portsnap in cron and firewall

2008-09-05 Thread Albert Shih
 Le 05/09/2008 à 11:33:59-0400, Sean Cavanaugh a écrit
 
 
  Date: Fri, 5 Sep 2008 16:14:02 +0200 From: [EMAIL PROTECTED]
  To: freebsd-questions@freebsd.org Subject: portsnap in cron and
  firewall  Hi all  I've some servers for internal use. On those
  servers I have some pf (or ipfw) rule to deny any connection from
  inside to outside.   Long time ago when ports tree is update with
  cvs, I'm using something like  pf command to open inside --
  outside connection cvsup  portupgrade --fetch-only --all pf
  command to close inside -- outside connection  But now with
  portsnap cron (that's mean random sleep) I don't known when the
  system try to connect outside.   Do you have any idea how can I
  make my update using portsnap (I known I can use cvsup) in a
  crontab with my network config ? 
  
 portsnap cron just randomizes the time to download unlike portsnap
 fetch which says to do it right now. cron was added to help randomize
 the time so everyone syncing at midnight UTC arent all hitting at
 exact same time.

Yes I known. That's why I'm asking you how can I make portsnap through the
cron and opening firewall just before he going to make the connection.

Of course I can hack the portsnap to make he don't try to see if it's fork
by cron or not. But it's not a good idea IMHO, what's happen if all person
do that ? 

Regards.

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


RE: portsnap in cron and firewall

2008-09-05 Thread Sean Cavanaugh


 Date: Fri, 5 Sep 2008 17:43:44 +0200 From: [EMAIL PROTECTED] To: [EMAIL 
 PROTECTED] CC: freebsd-questions@freebsd.org Subject: Re: portsnap in cron 
 and firewall   Le 05/09/2008 à 11:33:59-0400, Sean Cavanaugh a écrit   
 Date: Fri, 5 Sep 2008 16:14:02 +0200 From: [EMAIL PROTECTED]   
 To: freebsd-questions@freebsd.org Subject: portsnap in cron and   
 firewall  Hi all  I've some servers for internal use. On those   
 servers I have some pf (or ipfw) rule to deny any connection from   
 inside to outside.   Long time ago when ports tree is update with   cvs, 
 I'm using something like  pf command to open inside --   outside 
 connection cvsup  portupgrade --fetch-only --all pf   command to close 
 inside -- outside connection  But now with   portsnap cron (that's mean 
 random sleep) I don't known when the   system try to connect outside.   
 Do you have any idea how can I   make my update using portsnap (I known I 
 can use cvsup) in a   crontab with my network config ? portsnap 
 cron just randomizes the time to download unlike portsnap  fetch which 
 says to do it right now. cron was added to help randomize  the time so 
 everyone syncing at midnight UTC arent all hitting at  exact same time.  
 Yes I known. That's why I'm asking you how can I make portsnap through the 
 cron and opening firewall just before he going to make the connection.  Of 
 course I can hack the portsnap to make he don't try to see if it's fork by 
 cron or not. But it's not a good idea IMHO, what's happen if all person do 
 that ? 
I think you misread what i was saying. Inside your cron job use portsnap 
fetch instead of portsnap cron. that way it will fetch exactly when you run 
the cron job, without the randomized delay.
 
most likely a shell script that would have the following:
1)open pf
2)portsnap fetch
3)portsnap update (- you were missing this important step also)
4)portupgrade --fetch-only --all
5)close pf___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: portsnap in cron and firewall

2008-09-05 Thread Albert Shih
 Le 05/09/2008 à 11:51:57-0400, Sean Cavanaugh a écrit
 ---
 
  Yes I known. That's why I'm asking you how can I make portsnap through the
  cron and opening firewall just before he going to make the connection.
 
  Of course I can hack the portsnap to make he don't try to see if it's fork
  by cron or not. But it's not a good idea IMHO, what's happen if all person
  do that ?
 
 I think you misread what i was saying. Inside your cron job use portsnap
 fetch instead of portsnap cron. that way it will fetch exactly when you run
 the cron job, without the randomized delay.
  
 most likely a shell script that would have the following:
 1)open pf
 2)portsnap fetch
 3)portsnap update (- you were missing this important step also)
 4)portupgrade --fetch-only --all
 5)close pf

Yes I known ;-) and I understand what you saying. But what I'm saying is if
the developper of portsnap think it's useful to put some randomized delay
I'm going to follow this. Because if I make what you say how can I known
after 1 or 2 years there no other enough users to do same thing and make the
portsnap server overload ? Event I make some «randomize» time in the
crontab it's only when I make the crontab, that's mean every day the
portsnap is launch in the same moment. 

The best solution is to make some «hook_script» in the portsnap and after
the randomize delay is over just before the fetch is launch to run a
hook-script

So now 
portsnap cron = sleep random_time; portsnap fetch

what I think is 

portsnap cron -h hook-script = sleep random_time; sh hook-script; 
portsnap fetch

regards.


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


Re: portsnap in cron and firewall

2008-09-05 Thread RW
On Fri, 5 Sep 2008 16:14:02 +0200
Albert Shih [EMAIL PROTECTED] wrote:

 Hi all
 
 I've some servers for internal use. On those servers I have some pf
 (or ipfw) rule to deny any connection from inside to outside. 
 
 Long time ago when ports tree is update with cvs, I'm using something
 like
 
 pf command to open inside -- outside connection
 cvsup 
 portupgrade --fetch-only --all
 pf command to close inside -- outside connection
 
 But now with portsnap cron (that's mean random sleep) I don't known
 when the system try to connect outside. 
 
 Do you have any idea how can I make my update using portsnap (I known

You can do this

sleep `jot -r  1 0 3599`
open pf
portsnap fetch
close pf


However, I would suggest you simply create pf rules to allow the
server contact to the portsnap servers. 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: portsnap in cron and firewall

2008-09-05 Thread RW
On Fri, 5 Sep 2008 16:49:26 +0100
RW [EMAIL PROTECTED] wrote:

 On Fri, 5 Sep 2008 16:14:02 +0200
 Albert Shih [EMAIL PROTECTED] wrote:
 
But now with portsnap cron (that's mean random sleep) I don't known
  when the system try to connect outside. 

 You can do this
 
 sleep `jot -r  1 0 3599`
 open pf
 portsnap fetch
 close pf


Actually, I just took a look at portsnap and I see that portsnap fetch
has an explicit check for a terminal, so it wont work from crontab.

 
 However, I would suggest you simply create pf rules to allow the
 server contact to the portsnap servers. 
___
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]


Cron Question

2008-09-02 Thread ElihuJ

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.

___
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: restart named in a cron

2008-06-25 Thread Nicolas Letellier
Le Tue, 24 Jun 2008 21:48:42 +0300,
Manolis Kiagias [EMAIL PROTECTED] a écrit :

 Nicolas Letellier wrote:
  Hi.
 
  I want to restart named in a script executed by a cron. My script
  is:
 
  #!/bin/sh
  # verify named conf and restart it
  /usr/sbin/named-checkconf
  if [ ! $? -eq 0 ]; then
  echo Errors when verifying named configuration
  exit 1
  else
  /etc/rc.d/named restart  /dev/null
  fi
 
  # Ok, it's done
  exit 0
 
 
  However, the cron returns some errors:
  umount: not found
  mtree: not found
  umount: not found
  mount: not found
  /etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs
  on /var/named/dev devfs: not found
  devfs: not found
 
  I can restart named manually, but not with a cron.
 
  Do you have an idea to solve this problem? Why could I restart it
  manually and not with a cron?
 
  Thanks!
 

 Well, probably cron does not share your environment, thus it does
 not have your PATH. It  simply cannot find the commands you see as
 not found. Try inserting something like:
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin
 
 at the top of your script. Alternatively, you could use full paths to 
 the commands in the script, but it seems the errors come from the
 system scriprt, /etc/rc.d/named and you wouldn't want to touch that.

Thanks, it works when I define my PATH in the script. Indeed, I
couldn't add full path in the script because the error was due
to /etc/rc.d/named script.

Thanks for the help!

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


restart named in a cron

2008-06-24 Thread Nicolas Letellier
Hi.

I want to restart named in a script executed by a cron. My script is:

#!/bin/sh
# verify named conf and restart it
/usr/sbin/named-checkconf
if [ ! $? -eq 0 ]; then
echo Errors when verifying named configuration
exit 1
else
/etc/rc.d/named restart  /dev/null
fi

# Ok, it's done
exit 0


However, the cron returns some errors:
umount: not found
mtree: not found
umount: not found
mount: not found
/etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on 
/var/named/dev
devfs: not found
devfs: not found

I can restart named manually, but not with a cron.

Do you have an idea to solve this problem? Why could I restart it manually and 
not with a cron?

Thanks!

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


Re: restart named in a cron

2008-06-24 Thread Schiz0
On Tue, Jun 24, 2008 at 2:17 PM, Nicolas Letellier [EMAIL PROTECTED] wrote:
 Hi.

 I want to restart named in a script executed by a cron. My script is:

 #!/bin/sh
 # verify named conf and restart it
 /usr/sbin/named-checkconf
 if [ ! $? -eq 0 ]; then
echo Errors when verifying named configuration
exit 1
 else
/etc/rc.d/named restart  /dev/null
 fi

 # Ok, it's done
 exit 0


 However, the cron returns some errors:
 umount: not found
 mtree: not found
 umount: not found
 mount: not found
 /etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on 
 /var/named/dev
 devfs: not found
 devfs: not found

 I can restart named manually, but not with a cron.

 Do you have an idea to solve this problem? Why could I restart it manually 
 and not with a cron?

 Thanks!

 --
  -Nicolas.

The /etc/rc.d/named script probably relies on the $PATH to start some
stuff up. Since it's run via cron, try setting the $PATH in your
crontab (or the script itself).
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: restart named in a cron

2008-06-24 Thread Kevin Kinsey

Nicolas Letellier wrote:

Hi.

I want to restart named in a script executed by a cron. My script is:

#!/bin/sh
# verify named conf and restart it
/usr/sbin/named-checkconf
if [ ! $? -eq 0 ]; then
echo Errors when verifying named configuration
exit 1
else
/etc/rc.d/named restart  /dev/null
fi

# Ok, it's done
exit 0


However, the cron returns some errors:
umount: not found
mtree: not found
umount: not found
mount: not found
/etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on 
/var/named/dev
devfs: not found
devfs: not found

I can restart named manually, but not with a cron.

Do you have an idea to solve this problem? Why could I restart it manually and 
not with a cron?



cron doesn't know about your $PATH, but has a very limited $PATH
of its own.  Rewrite the script using the full pathnames to the
desired executables.

Kevin Kinsey

--
But these pills can't be habit forming;
I've been taking them for years.

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


Re: restart named in a cron

2008-06-24 Thread Jerry McAllister
On Tue, Jun 24, 2008 at 08:17:20PM +0200, Nicolas Letellier wrote:

 Hi.
 
 I want to restart named in a script executed by a cron. My script is:
 
 #!/bin/sh
 # verify named conf and restart it
 /usr/sbin/named-checkconf
 if [ ! $? -eq 0 ]; then
 echo Errors when verifying named configuration
 exit 1
 else
 /etc/rc.d/named restart  /dev/null
 fi
 
 # Ok, it's done
 exit 0
 
 
 However, the cron returns some errors:
 umount: not found
 mtree: not found
 umount: not found
 mount: not found
 /etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on 
 /var/named/dev
 devfs: not found
 devfs: not found
 
 I can restart named manually, but not with a cron.
 
 Do you have an idea to solve this problem? Why could I restart it 
 manually and not with a cron?

The CRON jog is missing /sbin and /usr/sbin from its path.
Try setting $PATH in the script.

jerry


 
 Thanks!
 
 -- 
  -Nicolas.
 ___
 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: restart named in a cron

2008-06-24 Thread Manolis Kiagias

Nicolas Letellier wrote:

Hi.

I want to restart named in a script executed by a cron. My script is:

#!/bin/sh
# verify named conf and restart it
/usr/sbin/named-checkconf
if [ ! $? -eq 0 ]; then
echo Errors when verifying named configuration
exit 1
else
/etc/rc.d/named restart  /dev/null
fi

# Ok, it's done
exit 0


However, the cron returns some errors:
umount: not found
mtree: not found
umount: not found
mount: not found
/etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on 
/var/named/dev
devfs: not found
devfs: not found

I can restart named manually, but not with a cron.

Do you have an idea to solve this problem? Why could I restart it manually and 
not with a cron?

Thanks!

  
Well, probably cron does not share your environment, thus it does not  
have your PATH. It  simply cannot find the commands you see as not found.

Try inserting something like:

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

at the top of your script. Alternatively, you could use full paths to 
the commands in the script, but it seems the errors come from the system 
scriprt, /etc/rc.d/named and you wouldn't want to touch that.


___
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]


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

2008-05-03 Thread Gilles
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?

Thank you.

___
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]


Cron question

2008-04-24 Thread John Almberg
I have recently switched from Linux to FreeBSD for my web server.  
Absolutely love it, but am having one difficulty that is driving me  
bats...


I wouldn't think that cron would run differently on BSD than Linux,  
but it seemingly does. I have a user crontab that runs a PHP script  
once a day. This worked effortlessly on the old box.


If I am logged in as the user (gs), I can run the script without  
problem just by typing the command line ./script.php, or /full/path/ 
to/script.php


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)


HOWEVER, absolutely nothing happens as a result. No error message in  
any /var/log file, and script.log is not even touched, even though  
the script is quite verbose and logs a bunch of stuff when it runs.


It is as if the script was never run. I have looked at this every  
which way, but it doesn't make any sense to me. There are other  
scripts in the same crontab that run without problem.


I have tried changing the crontab to:

0 15 * * * /usr/local/bin/php /home/gs/bin/script.php /home/gs/log/ 
script.log


But that has no effect.

So, the question is, how can a script that runs perfectly when  
executed by user gs from the command line, not work at all when run  
as user gs's crontab? Not even generate an error message or log  
entry? What is different in the user crontab runtime environment?


Any insight much appreciated.

Brgds: John

[EMAIL PROTECTED] ~]$ uname -a
FreeBSD on.identry.com 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #1: Mon  
Dec  3 09:46:53 EST 2007 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/ 
INET_ON  amd64


[EMAIL PROTECTED] ~]$ which php
/usr/local/bin/php


___
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]


cron to attach a gz file

2008-01-31 Thread Zbigniew Szalbot
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)?

Also, is it possible to actually transfer the log file by ftp using cron?
If so, would anyone be willing to share how to set it up?

Many thanks in advance!

Zbigniew Szalbot
___
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]


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

2007-12-03 Thread Rudy


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,775122 /
cron  54668 root  txt   VREG   0,82  32496   122864 
/usr/sbin/cron
cron  54668 root  txt   VREG   0,77 16271249929 
/libexec/ld-elf.so.1
cron  54668 root  txt   VREG   0,77  4478849922 
/lib/libutil.so.5
cron  54668 root  txt   VREG   0,77 94195249923 
/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  6460449928 
/lib/libz.so.3
cron  54668 root  txt   VREG   0,77 10743249918 
/lib/libm.so.4
cron  54668 root  txt   VREG   0,77  2864849916 
/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 0xc66658580t0  
-0xc67e89bc
cron  54667 root  cwd   VDIR   0,80512   471040 
/var/cron
cron  54667 root  rtd   VDIR   0,775122 /
cron  54667 root  txt   VREG   0,82  32496   122864 
/usr/sbin/cron
cron  54667 root  txt   VREG   0,77 16271249929 
/libexec/ld-elf.so.1
cron  54667 root  txt   VREG   0,77  4478849922 
/lib/libutil.so.5
cron  54667 root  txt   VREG   0,77 94195249923 
/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  6460449928 
/lib/libz.so.3
cron  54667 root  txt   VREG   0,77 10743249918 
/lib/libm.so.4
cron  54667 root  txt   VREG   0,77  2864849916 
/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 0xc66658580t0  
-0xc67e89bc
cron  54667 root6u  PIPE 0xcc473198  16384  
-0xcc473250
cron  54667 root7u  unix 0xc67e86f40t0  
-(none)
cron  54667 root8u  PIPE 0xcc473250  0  
-0xcc473198

What is going on?  Is my libnss_mysql acting up?

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-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]


cron/send mail question

2007-11-15 Thread zbigniew szalbot

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.


Thanks a lot in advance!

Zbigniew Szalbot
___
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]


Help Plz... Cron Job question....hellp...

2007-10-31 Thread VeeJay
Hello Gurus….



I am running a status script written in Perl (*status.pl*) and want to have
it *Always Running*.



How can I check through CRON that status.pl is running and if NO, then
start the script execution again?



Please help and advise…



With a bundle of thanks!


-- 
Thanks!

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


Help with Cron pleazzzzzzzzzzzz

2007-10-31 Thread VeeJay
Hello Gurus….



I am running a status script written in Perl (*status.pl*) and want to have
it *Always Running*.



How can I check through CRON that status.pl is running and if NO, then
start the script execution again?



Please help and advise…



With a bundle of thanks!


-- 
Thanks!

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


Re: Help with Cron pleazzzzzzzzzzzz

2007-10-31 Thread Bill Moran
In response to VeeJay [EMAIL PROTECTED]:

 Hello Gurus….
 
 
 
 I am running a status script written in Perl (*status.pl*) and want to have
 it *Always Running*.
 
 
 
 How can I check through CRON that status.pl is running and if NO, then
 start the script execution again?
 
 
 
 Please help and advise…

Have you considered something like daemontools?  It's designed for such
a task, as opposed to reinventing the wheel.

-- 
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: Help with Cron pleazzzzzzzzzzzz

2007-10-31 Thread Mike Jeays
On October 31, 2007 07:58:21 am VeeJay wrote:
 Hello Gurus….



 I am running a status script written in Perl (*status.pl*) and want to have
 it *Always Running*.



 How can I check through CRON that status.pl is running and if NO, then
 start the script execution again?



 Please help and advise…



 With a bundle of thanks!

You could write a shell script something like:

#!/bin/bash
ps -ax | grep 'status.pl'
if [ $q -eq 0 ]
then
  status.pl
fi

grep will return zero if it finds a line containing 'status.pl', and 1 
otherwise.

in crontab, use

* * * * * /full/path/to/script-above

and it will check every minute.

But a better fix would be to find the bug in status.pl that makes it crash!




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


Re: Help with Cron pleazzzzzzzzzzzz

2007-10-31 Thread John Nielsen

Quoting Mike Jeays [EMAIL PROTECTED]:

On October 31, 2007 07:58:21 am VeeJay wrote:

I am running a status script written in Perl (*status.pl*) and want to have
it *Always Running*.

How can I check through CRON that status.pl is running and if NO, then
start the script execution again?

Please help and advise...


You could write a shell script something like:


A couple nits:


#!/bin/bash


#!/bin/sh


ps -ax | grep 'status.pl'


This should probably be something like ps -ax | grep 'status.pl' | 
grep -v grep so you don't get false positives from the grep process 
itself.


JN


if [ $q -eq 0 ]
then
 status.pl
fi

grep will return zero if it finds a line containing 'status.pl', and 1
otherwise.

in crontab, use

* * * * * /full/path/to/script-above

and it will check every minute.

But a better fix would be to find the bug in status.pl that makes it crash!




--
Mike Jeays
http://www.jeays.ca
___
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: Help Plz... Cron Job question....hellp...

2007-10-31 Thread Michaël Grünewald
VeeJay [EMAIL PROTECTED] writes:

 Hello Gurus….



 I am running a status script written in Perl (*status.pl*) and want to have
 it *Always Running*.

 How can I check through CRON that status.pl is running and if NO, then
 start the script execution again?

Why don't you use the following SH script?

  whule true; do
perl status.pl
  done

It will restart `status.pl' whenever it dies.
-- 
Best wishes,
Michaël
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Help with Cron pleazzzzzzzzzzzz

2007-10-31 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



On 10/31/07, VeeJay  wrote:
 I am running a status script written in Perl (*status.pl*) and want to have
 it *Always Running*.



 How can I check through CRON that status.pl is running and if NO, then
 start the script execution again?


Run monit.

http://www.freshports.org/sysutils/monit/

Here's an example config for making sure sshd is running:

$ cat /etc/monit.d/sshd
check process sshd with pidfile /var/run/sshd.pid
  start program  /etc/init.d/sshd start
  stop program  /etc/init.d/sshd stop
  if failed port 22 protocol ssh then restart
  if 5 restarts within 5 cycles then timeout

- --
Andy Harrison
public key: 0x67518262
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: http://firegpg.tuxfamily.org

iD8DBQFHKHeKNTm8fWdRgmIRAoZGAJ0ZJCzDedOEzVqJFYlniZshPKJmPwCaA8Uh
pPYRFCDdrIk1YgYPcyH0hew=
=dr1X
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Help with Cron pleazzzzzzzzzzzz

2007-10-31 Thread RW
On Wed, 31 Oct 2007 10:02:53 -0400
John Nielsen [EMAIL PROTECTED] wrote:


 This should probably be something like ps -ax | grep 'status.pl' | 
 grep -v grep so you don't get false positives from the grep process 
 itself.
 

or simply use: pgrep status\.pl
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Help Plz... Cron Job question....hellp...

2007-10-31 Thread Tino Engel
call a script called script.sh from cron e.g. every minute.
script.sh contains:

#!/bin/sh
ps -a | grep status.pl | |  perl status.pl

Am Mittwoch 31 Oktober 2007 08:32 schrieb VeeJay:
 Hello Gurus….



 I am running a status script written in Perl (*status.pl*) and want to have
 it *Always Running*.



 How can I check through CRON that status.pl is running and if NO, then
 start the script execution again?



 Please help and advise…



 With a bundle of thanks!


pgpFA51yluLwN.pgp
Description: PGP signature


FTP CRON Script

2007-10-10 Thread White Hat
This is driving me crazy. I have a small script that I
run from CRON. It is run as a regular user and not as
ROOT, although I have tried it both ways. It uploads
SPAM to the 'knujon.com' site'.

I have created a ~/.netrc file that looks like this:

machine knujon.com
login user
password secret


macdef  spam
put $1
quit



Now, if I run the following command from the command
prompt, the script works fine.

echo \$ spam spam.zip | ftp -n
ftp://user:[EMAIL PROTECTED]

The above should all be on one line, although it may
be shown split into two right now.

However, if this is put into a bash script, and run if
from CRON, I receive a mail with this error message:

'spam' macro not found.

I have no idea what I am doing wrong.

I have the $HOME, $SHELL and $PATH variables set in
CRON.


-- 
White Hat 
[EMAIL PROTECTED]


   

Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: FTP CRON Script

2007-10-10 Thread Derek Ragona

At 04:31 PM 10/10/2007, White Hat wrote:

This is driving me crazy. I have a small script that I
run from CRON. It is run as a regular user and not as
ROOT, although I have tried it both ways. It uploads
SPAM to the 'knujon.com' site'.

I have created a ~/.netrc file that looks like this:

machine knujon.com
login user
password secret


macdef  spam
put $1
quit



Now, if I run the following command from the command
prompt, the script works fine.

echo \$ spam spam.zip | ftp -n
ftp://user:[EMAIL PROTECTED]

The above should all be on one line, although it may
be shown split into two right now.

However, if this is put into a bash script, and run if
from CRON, I receive a mail with this error message:

'spam' macro not found.

I have no idea what I am doing wrong.

I have the $HOME, $SHELL and $PATH variables set in
CRON.


try set -x and see what the output looks like.  I'd guess you are not 
escaping the $ right in your script.


-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]


Cron not working till 28/08/07

2007-09-19 Thread DSA - JCR
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]


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]


cron jobs not done during sleep

2007-09-17 Thread Steve Franks
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.

Thanks,
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 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: FreeBSD Cron Job to run (ifconfig em0 down; ifconfig em0 up)

2007-08-31 Thread Hinkie
Dear People

As a courtesy to anyone interested I have finally sovled this (I hope), this is 
what I did, this is on a FreeBSD pfSense firewall router.

Essentially the fix is to ping the static IP's first hop, if this is down then 
flick the WAN NIC state down and up, this restores 
the lost connection where the Motorola 5101 has stopped sending packets 
(presumably for some incompatibility reason)  The Motorola 
5101 has today been replaced with a 5100, the ISP tell me most commercial lines 
are running the 5100 as they say it is more router 
compatible than the newer 5101.  I'll advise if the 5100 exhibits the same 
behaviour(!) however if it does the following should 
address it within a minute.  If you are copying it be sure to copy it exactly 
as spaces in the wrong place stuff it upetc!!

For both the lists and my record it is done by:

= in /etc/crontab add
*/1 * * * * root /usr/bin/pinger.sh

= from edit.php create / write into new file /usr/bin/pinger.sh
#!/bin/sh

ping -c1 Insert_1st_Gateway_Hop_Here_commonly_Static_IP_a.b.c.1
if [ $? -eq 2 ]; then
ifconfig em0 down
ifconfig em0 up
echo 'Gateway Down'
else
echo 'Gateway Up'
fi

= from exec.php run chmod u+x /usr/bin/pinger.sh

= from exec.php run ls -l /usr/bin/pinger.sh
and check there is an x in the file permissions (for executable)

It will have run when you see a log series of commands starting with
Sep 1 11:32:13 kernel: em0: link state changed to UP
Sep 1 11:32:11 kernel: em0: link state changed to DOWN

The only problem I see with this approach is that whenever the Internet is down 
for whatever reason the WAN interface is going to be 
disconnected and reconnected every minute, as well as filling the logs with 
this info, but that seems only of concern from the 
perspective of filling the log with rubbish.  I might tinker with it to send me 
an email to advise me when the code has also run .

Thank you again to the people who worked with me on this.

Kind regards
David Hingston 
___
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   4   5   6   7   >