Re: Problems with a bash script and cron

2000-10-13 Thread Felix Hagemann
Wayne Topa [EMAIL PROTECTED] writes:

   My crontab looks like this:
   
   0,15,30,45 * * * /home/laban/bin/chkwww
 
 so you might try
 0,15,30,45 * * * * /home/laban/bin/chkwww

The `user` field exists only in the systemwide /etc/crontab.  The
user-owned crontabs obviously don`t need the entry.  But I don`t have
the original article to check which one he referred to.

Bye,
Fx

-- 
If a man does not keep pace with his companions, perhaps it is because
he hears a different drummer. Henry D. Thoreau



Re: Problems with a bash script and cron

2000-10-13 Thread Wayne Topa

Subject: Re: Problems with a bash script and cron
Date: Fri, Oct 13, 2000 at 01:34:30PM +0200

In reply to:Felix Hagemann

Quoting Felix Hagemann([EMAIL PROTECTED]):
 Wayne Topa [EMAIL PROTECTED] writes:
 
My crontab looks like this:

0,15,30,45 * * * /home/laban/bin/chkwww
  
  so you might try
  0,15,30,45 * * * * /home/laban/bin/chkwww
 
 The `user` field exists only in the systemwide /etc/crontab.  The
 user-owned crontabs obviously don`t need the entry.  But I don`t have
 the original article to check which one he referred to.

I had _not_ suggested he required the user field.  Let me try this
again;

m  h dom mon dow
0,15,30,45 *  *   *

0,15,30,45 *  *   *   *

He does not have an entry for the 'day of the week' field .  I had never
tried using cron with less thæn the suggested argument fields, so I
tested it.  A working example was changed to his, dow missing,
example.

(working example)
15,45 8-22 * * * root /usr/local/bin/play /usr/lib/sounds/ring.au

(Test without 'dow' field)
1-20 8-22 * *  root /usr/local/bin/play /usr/lib/sounds/ring.au 

The test did not work. As I read crontab(5) it shouldn't work.

   commands are executed by cron(8) when  the  minute,  hour,
   and  month of year fields match the current time, and when
   at least one of the two day fields (day of month,  or  day
   of  week)  match  the  current  time (see ``Note'' below).
   cron(8) examines cron entries once every minute.  The time
   and date fields are:

   [ snip field parameters]

   A  field  may  be an asterisk (*), which always stands for
   ``first-last''.


Adding the dow field to the above test example, did in fact, work.

I guess my original post
# m h dom mon dow user  command

so you might try
0,15,30,45 * * * * /home/laban/bin/chkwww
 ^

Was not clear enough (?).
-- 
Real programmers don't write in BASIC.  Actually, no programmers write
in BASIC after reaching puberty.
___



Re: Problems with a bash script and cron

2000-10-13 Thread Felix Hagemann
Wayne Topa [EMAIL PROTECTED] writes:

 I had _not_ suggested he required the user field.  Let me try this
 again;
 
 m  h dom mon dow
 0,15,30,45 *  *   *
 
 0,15,30,45 *  *   *   *

I`m sorry:  I didn`t see that in fact one field was missing.  I`ve just
seen it often that people get mixed up with the different crontab-styles.

 I guess my original post
 Was not clear enough (?).

Obviously not :)

Bye,
Fx

-- 
Hi, I`m Delilah from Microsoft Sales and Reeducation Services. You and I
have a lot of work to do!   (c) www.userfriendly.org



Re: Problems with a bash script and cron

2000-10-11 Thread Felix Hagemann
Lars Bjarby [EMAIL PROTECTED] writes:

 My crontab looks like this:
 
 0,15,30,45 * * * /home/laban/bin/chkwww

It's not in all man page versions I have seen: you're probably just
missing a trailing Newline at the end of your crontab.

HTH,
Fx

-- 
Gravity. It's not a rule, it's the law!

 



Re: Problems with a bash script and cron

2000-10-11 Thread will trillich
Lars Bjarby [EMAIL PROTECTED] writes:
 My crontab looks like this:
 
 0,15,30,45 * * * /home/laban/bin/chkwww

things to try:
1) chmod +x /home/laban/bin/chkwww
2) make sure you 'crontab -e' as same user you use
to run the script from the command prompt
3) try 
0,15,30,45 * * * /bin/sh /home/laban/bin/chkwww
4) try
0,15,30,45 * * * /home/laban/bin/chkwww | mail -s crontab-run 
laban 

-- 
things are more like they used to be than they are now.

[EMAIL PROTECTED] *** http://www.dontUthink.com/



Re: Problems with a bash script and cron

2000-10-11 Thread Wayne Topa

Subject: Re: Problems with a bash script and cron
Date: Wed, Oct 11, 2000 at 08:27:58AM +0200

In reply to:Felix Hagemann

Quoting Felix Hagemann([EMAIL PROTECTED]):
 Lars Bjarby [EMAIL PROTECTED] writes:
 
  My crontab looks like this:
  
  0,15,30,45 * * * /home/laban/bin/chkwww
 
 It's not in all man page versions I have seen: you're probably just
 missing a trailing Newline at the end of your crontab.

Late on this thread but the above crontab entry looks short to me.

My Crontab has, at the top.

# m h dom mon dow user  command

so you might try
0,15,30,45 * * * * /home/laban/bin/chkwww
 ^
:-) HTH, YMMV, HAND :-)

-- 
According to my calculations the problem doesn't exist.
___



Re: Problems with a bash script and cron

2000-10-10 Thread Krzys Majewski
Try  replacing your  script (call  it script.sh)  with  another script
which does a

sh -x script.sh 21 | logger

In my case  problems like yours come from  using commands which aren't
in the path. -chris





Re: Problems with a bash script and cron

2000-10-10 Thread W. Paul Mills

Sounds like a path problem to me!


Lars Bjarby [EMAIL PROTECTED] wrote:
: Hi!

: This question isn't really Debian specific, but as I use Debian I thought 
: this was a good forum. I've got this small bash script that works perfectly 
: when I run it from the shell, but it won't work when I try to run it 
: through cron and I don't get any error messages from the cron daemon either 
: (maybe I'm looking in the wrong places).

: The script below downloads the specified URL and generates and MD5 sum for 
: the  HTML source. If this is the first time the script is run it saves the 
: MD5 sum in a file otherwise the MD5 sum is checked against the old one. If 
: they differ, the script will send an e-mail to me.

: (yes, I know this script really isn't useful for slashdot as the page is 
: different every time...but it's good for debuging)

: 
--8--8--8--8--8--8--
: #!/bin/bash

: EMAIL=[EMAIL PROTECTED]
: MD5FILE=/home/laban/tmp/chkwww.md5
: URL=http://www.slashdot.org;
: DATE=`date +%Y-%m-%d %H:%M`
: SUBJECT=Update - $DATE
: LOG=FALSE
: LOGFILE=/home/laban/tmp/chkwww.log

: ###

: if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tChecking for 
: updates... $LOGFILE; fi

: MD5SUM_NOW=`lynx --source $URL | md5sum`

: if [ ! -e $MD5FILE ]; then
:  echo $MD5SUM_NOW  $MD5FILE
:  exit
: fi

: MD5SUM_DISK=`head -1 $MD5FILE`
: echo $MD5SUM_NOW  $MD5FILE

: if [ $MD5SUM_NOW != $MD5SUM_DISK ]; then
:  echo $URL has been updated. | mail -s $SUBJECT $EMAIL
:  if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tPage updated, 
: notification sent to $EMAIL. $LOGFILE; fi
: else
:  if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tPage not 
: updated. $LOGFILE; fi
: fi

: if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tExiting... $LOGFILE; fi
: 
--8--8--8--8--8--8--

: My crontab looks like this:

: 0,15,30,45 * * * /home/laban/bin/chkwww

: Any ideas?

: .//Laban - [EMAIL PROTECTED] - [EMAIL PROTECTED] - Public PGP-key available


: -- 
: Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED]  /dev/null

-- 
*** Running Debian Linux ***
*   For God so loved the world that He gave his only begotten Son,  *
*   that whoever believes in Him should not perish...John 3:16  *
* W. Paul Mills  *  Topeka, Kansas, U.S.A.  *
* EMAIL= [EMAIL PROTECTED]  *  WWW= http://Mills-USA.com/  *
* Bill, I was there several years ago, why would I want to go back? *
* pgp public key on keyservers everywhere? */
-- 



Problems with a bash script and cron

2000-10-09 Thread Lars Bjarby

Hi!

This question isn't really Debian specific, but as I use Debian I thought 
this was a good forum. I've got this small bash script that works perfectly 
when I run it from the shell, but it won't work when I try to run it 
through cron and I don't get any error messages from the cron daemon either 
(maybe I'm looking in the wrong places).


The script below downloads the specified URL and generates and MD5 sum for 
the  HTML source. If this is the first time the script is run it saves the 
MD5 sum in a file otherwise the MD5 sum is checked against the old one. If 
they differ, the script will send an e-mail to me.


(yes, I know this script really isn't useful for slashdot as the page is 
different every time...but it's good for debuging)


--8--8--8--8--8--8--
#!/bin/bash

EMAIL=[EMAIL PROTECTED]
MD5FILE=/home/laban/tmp/chkwww.md5
URL=http://www.slashdot.org;
DATE=`date +%Y-%m-%d %H:%M`
SUBJECT=Update - $DATE
LOG=FALSE
LOGFILE=/home/laban/tmp/chkwww.log

###

if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tChecking for 
updates... $LOGFILE; fi


MD5SUM_NOW=`lynx --source $URL | md5sum`

if [ ! -e $MD5FILE ]; then
echo $MD5SUM_NOW  $MD5FILE
exit
fi

MD5SUM_DISK=`head -1 $MD5FILE`
echo $MD5SUM_NOW  $MD5FILE

if [ $MD5SUM_NOW != $MD5SUM_DISK ]; then
echo $URL has been updated. | mail -s $SUBJECT $EMAIL
if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tPage updated, 
notification sent to $EMAIL. $LOGFILE; fi

else
if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tPage not 
updated. $LOGFILE; fi

fi

if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tExiting... $LOGFILE; fi
--8--8--8--8--8--8--

My crontab looks like this:

0,15,30,45 * * * /home/laban/bin/chkwww

Any ideas?

.//Laban - [EMAIL PROTECTED] - [EMAIL PROTECTED] - Public PGP-key available



Re: Problems with a bash script and cron

2000-10-09 Thread Rino Mardo
try removing #!/bin/bash



---
who watches the watchmen?
- Original Message -
From: Lars Bjarby [EMAIL PROTECTED]
To: debian-user@lists.debian.org
Sent: Monday, October 09, 2000 9:22 AM
Subject: Problems with a bash script and cron


 Hi!

 This question isn't really Debian specific, but as I use Debian I thought
 this was a good forum. I've got this small bash script that works
perfectly
 when I run it from the shell, but it won't work when I try to run it
 through cron and I don't get any error messages from the cron daemon
either
 (maybe I'm looking in the wrong places).

 The script below downloads the specified URL and generates and MD5 sum for
 the  HTML source. If this is the first time the script is run it saves the
 MD5 sum in a file otherwise the MD5 sum is checked against the old one. If
 they differ, the script will send an e-mail to me.

 (yes, I know this script really isn't useful for slashdot as the page is
 different every time...but it's good for debuging)

 --8--8--8--8--8--8--

 #!/bin/bash

 EMAIL=[EMAIL PROTECTED]
 MD5FILE=/home/laban/tmp/chkwww.md5
 URL=http://www.slashdot.org;
 DATE=`date +%Y-%m-%d %H:%M`
 SUBJECT=Update - $DATE
 LOG=FALSE
 LOGFILE=/home/laban/tmp/chkwww.log

 ###

 if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tChecking for
 updates... $LOGFILE; fi

 MD5SUM_NOW=`lynx --source $URL | md5sum`

 if [ ! -e $MD5FILE ]; then
  echo $MD5SUM_NOW  $MD5FILE
  exit
 fi

 MD5SUM_DISK=`head -1 $MD5FILE`
 echo $MD5SUM_NOW  $MD5FILE

 if [ $MD5SUM_NOW != $MD5SUM_DISK ]; then
  echo $URL has been updated. | mail -s $SUBJECT $EMAIL
  if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tPage updated,
 notification sent to $EMAIL. $LOGFILE; fi
 else
  if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tPage not
 updated. $LOGFILE; fi
 fi

 if [ $LOG = TRUE ]; then echo -e $DATE\t$0\tExiting... $LOGFILE;
fi
 --8--8--8--8--8--8--


 My crontab looks like this:

 0,15,30,45 * * * /home/laban/bin/chkwww

 Any ideas?

 .//Laban - [EMAIL PROTECTED] - [EMAIL PROTECTED] - Public PGP-key available


 --
 Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED] 
/dev/null




Re: Problems with a bash script and cron

2000-10-09 Thread Tommi Komulainen
On Mon, Oct 09, 2000 at 07:22:34AM +0200, Lars Bjarby wrote:
 This question isn't really Debian specific, but as I use Debian I thought 
 this was a good forum. I've got this small bash script that works perfectly 
 when I run it from the shell, but it won't work when I try to run it 
 through cron and I don't get any error messages from the cron daemon either 
 (maybe I'm looking in the wrong places).

Hmm, I vaguely remember lynx _requiring_ a tty, which in case of
cronjob is not available. Solution may be to replace lynx with wget, for
example.


-- 
Tommi Komulainen   [EMAIL PROTECTED]


pgpdTYrosUDo7.pgp
Description: PGP signature