Crontab not working logwatch.pl [FreeBSD 8 stable]

2010-01-13 Thread Jeronimo Calvo
Hi folks,

Im having probs when a root crontab located on /var/cron/tabs/root

with this content
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.DUtgfVoBT0 installed on Wed Jan 13 20:08:29 2010)
# (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v
1.31.2.1 2009/08/03 08:13:06 kensmith Exp $)
* * * * * ~/.profile ; /bin/bash /var/log/auto_auth.sh
* * * * * ~/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

both of them are sending logs to my email, when runned from the
command line works, but not from crontab
any ideas?

-- 
() ASCII Ribbon Campaign | Against HTML e-mail
/\  www.asciiribbon.org  | Against proprietary extensions
___
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: Crontab not working logwatch.pl [FreeBSD 8 stable]

2010-01-13 Thread Rolf Nielsen

On 2010-01-13 21:43, Jeronimo Calvo wrote:

Hi folks,

Im having probs when a root crontab located on /var/cron/tabs/root

with this content
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.DUtgfVoBT0 installed on Wed Jan 13 20:08:29 2010)
# (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v
1.31.2.1 2009/08/03 08:13:06 kensmith Exp $)
* * * * * ~/.profile ; /bin/bash /var/log/auto_auth.sh
* * * * * ~/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

both of them are sending logs to my email, when runned from the
command line works, but not from crontab
any ideas?



The keywords here are
# DO NOT EDIT THIS FILE - edit the master and reinstall.

Either edit the system crontab, /etc/crontab, or, to edit root's 
crontab, run crontab -e as root.

___
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: Crontab not working logwatch.pl [FreeBSD 8 stable]

2010-01-13 Thread Jeronimo Calvo
did a crontab -r, a a new crontab -e, using:

* * * * * $HOME/.profile ; /bin/bash /var/log/auto_auth.sh
* * * * * $HOME/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

tailing the /var/log/cron I can see that is being executed every
minute... but no emails arrived with is the proof that the script has
worked.



2010/1/13 Rolf Nielsen listrea...@lazlarlyricon.com:
 On 2010-01-13 21:43, Jeronimo Calvo wrote:

 Hi folks,

 Im having probs when a root crontab located on /var/cron/tabs/root

 with this content
 # DO NOT EDIT THIS FILE - edit the master and reinstall.
 # (/tmp/crontab.DUtgfVoBT0 installed on Wed Jan 13 20:08:29 2010)
 # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v
 1.31.2.1 2009/08/03 08:13:06 kensmith Exp $)
 * * * * * ~/.profile ; /bin/bash /var/log/auto_auth.sh
 * * * * * ~/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

 both of them are sending logs to my email, when runned from the
 command line works, but not from crontab
 any ideas?


 The keywords here are
 # DO NOT EDIT THIS FILE - edit the master and reinstall.

 Either edit the system crontab, /etc/crontab, or, to edit root's crontab,
 run crontab -e as root.




-- 
() ASCII Ribbon Campaign | Against HTML e-mail
/\  www.asciiribbon.org  | Against proprietary extensions
___
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: Crontab not working logwatch.pl [FreeBSD 8 stable]

2010-01-13 Thread Rolf Nielsen

On 2010-01-13 22:04, Jeronimo Calvo wrote:

did a crontab -r, a a new crontab -e, using:

* * * * * $HOME/.profile ; /bin/bash /var/log/auto_auth.sh
* * * * * $HOME/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

tailing the /var/log/cron I can see that is being executed every
minute... but no emails arrived with is the proof that the script has
worked.



2010/1/13 Rolf Nielsenlistrea...@lazlarlyricon.com:

On 2010-01-13 21:43, Jeronimo Calvo wrote:


Hi folks,

Im having probs when a root crontab located on /var/cron/tabs/root

with this content
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.DUtgfVoBT0 installed on Wed Jan 13 20:08:29 2010)
# (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v
1.31.2.1 2009/08/03 08:13:06 kensmith Exp $)
* * * * * ~/.profile ; /bin/bash /var/log/auto_auth.sh
* * * * * ~/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

both of them are sending logs to my email, when runned from the
command line works, but not from crontab
any ideas?



The keywords here are
# DO NOT EDIT THIS FILE - edit the master and reinstall.

Either edit the system crontab, /etc/crontab, or, to edit root's crontab,
run crontab -e as root.







Please don't top post.

Firstly, don't rely on environment variables being set correctly when 
running from cron. If you really want to use root's crontab, substitute 
/root for $HOME.
Secondly, bash should be in /usr/local/bin, not in /bin. And it's a 
third party shell not included by the system. It has to be installed 
from ports. You should use /bin/sh instead.
Thirdly, instead of putting the interpreter path on the command line, 
put it on the first line of your scripts, i.e.

#!/bin/sh in the first one
and
#!/usr/bin/perl in the second one.
___
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


Crontab not working??

2010-01-13 Thread Kaya Saman

Hi,

I installed logwatch from ports only it didn't install a crontab for me 
like Linux or Solaris does so I ended up attempting to copy my Linux 
crontab into FreeBSD.


It didn't work so I tried to cut down areas which I suspected might not 
work and ended up with the syntax below for root:


crontab -l shows:

@reboot   root/usr/local/sbin/logwatch.pl
02 4 * * * root/usr/local/sbin/logwatch.pl

The interesting thing here is that it shows them as being run:

rd1# cat /var/log/cron | grep logwatch
Jan 12 04:02:00 rd1 /usr/sbin/cron[5882]: (root) CMD 
(root^I/usr/local/sbin/logwatch.pl)
Jan 13 04:02:00 rd1 /usr/sbin/cron[8898]: (root) CMD 
(root^I/usr/local/sbin/logwatch.pl)


but only nothing is being emailed to me?

If I run the pearl file locally as in: /usr/local/sbin/logwatch.pl   it 
works fine and email is sent.


I know I am missing something but for the life of me can't work out what!

Can anyone be of assistance?

Many thanks,

Kaya

___
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: Crontab not working??

2010-01-13 Thread Chuck Swiger
Hi--

On Jan 13, 2010, at 4:20 PM, Kaya Saman wrote:
 It didn't work so I tried to cut down areas which I suspected might not work 
 and ended up with the syntax below for root:
 
 crontab -l shows:
 
 @reboot   root/usr/local/sbin/logwatch.pl
 02 4 * * * root/usr/local/sbin/logwatch.pl

You're using the syntax for a system-wide crontab, ie, /etc/crontab.  Per-user 
crontabs do not have the middle field listing the user to run as; re-run 
crontab -e and try this instead:

@reboot /usr/local/sbin/logwatch.pl
02 4 * * *  /usr/local/sbin/logwatch.pl

Regards,
-- 
-Chuck

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


Re: Crontab not working??

2010-01-13 Thread Kaya Saman
Thanks, I inputted the data as you suggested so now I will wait until 
the time specified to see if it ran or not!


Regards,

Kaya

Chuck Swiger wrote:

Hi--

On Jan 13, 2010, at 4:20 PM, Kaya Saman wrote:
  

It didn't work so I tried to cut down areas which I suspected might not work 
and ended up with the syntax below for root:

crontab -l shows:

@reboot   root/usr/local/sbin/logwatch.pl
02 4 * * * root/usr/local/sbin/logwatch.pl



You're using the syntax for a system-wide crontab, ie, /etc/crontab.  Per-user 
crontabs do not have the middle field listing the user to run as; re-run 
crontab -e and try this instead:

@reboot /usr/local/sbin/logwatch.pl
02 4 * * *  /usr/local/sbin/logwatch.pl

Regards,
  


___
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: Crontab not working??

2010-01-13 Thread Thomas K.
On Thu, Jan 14, 2010 at 02:20:07AM +0200, Kaya Saman wrote:

Hi,

 @reboot   root/usr/local/sbin/logwatch.pl
 02 4 * * * root/usr/local/sbin/logwatch.pl

this format/syntax is only valid for the system contab.

 The interesting thing here is that it shows them as being run:
 
 rd1# cat /var/log/cron | grep logwatch
 Jan 12 04:02:00 rd1 /usr/sbin/cron[5882]: (root) CMD 
 (root^I/usr/local/sbin/logwatch.pl)
 Jan 13 04:02:00 rd1 /usr/sbin/cron[8898]: (root) CMD 
 (root^I/usr/local/sbin/logwatch.pl)

As you can see, the command is not valid. You should at least get an
error. If the scripts do not set PATH themselvs, try setting it in the
crontab, as the default is rather minimal.

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


Re: Crontab not working logwatch.pl [FreeBSD 8 stable]

2010-01-13 Thread Glen Barber
Rolf Nielsen wrote: 
 On 2010-01-13 22:04, Jeronimo Calvo wrote:
  did a crontab -r, a a new crontab -e, using:
 
  * * * * * $HOME/.profile ; /bin/bash /var/log/auto_auth.sh
  * * * * * $HOME/.profile ; /usr/bin/perl /local/sbin/logwatch.pl
 

In addition to the other suggestions, I'd imagine an absolute path path to
/local/sbin/logwatch.pl is a problem as well.  Unless /local/sbin exists,
of course.

Regards,

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


Re: Crontab not working logwatch.pl [FreeBSD 8 stable]

2010-01-13 Thread Kaya Saman

Glen Barber wrote:
Rolf Nielsen wrote: 
  

On 2010-01-13 22:04, Jeronimo Calvo wrote:


did a crontab -r, a a new crontab -e, using:

* * * * * $HOME/.profile ; /bin/bash /var/log/auto_auth.sh
* * * * * $HOME/.profile ; /usr/bin/perl /local/sbin/logwatch.pl

  


In addition to the other suggestions, I'd imagine an absolute path path to
/local/sbin/logwatch.pl is a problem as well.  Unless /local/sbin exists,
of course.

Regards,

  


Many thanks for all the responses!!

I copied the data into /etc/crontab using the root syntax as described 
before and I got sent an email straight away after restarting cron!!


I am not sure why I decided to use a local crontab rather then 
system-wide one but I think I got confused somewhere along the lines 
with something??


At least it works :-)

Regards,

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