Re: cron problem

2009-07-03 Thread Chris Bennett

Frank Bax wrote:

Chris Bennett wrote:

steve szmidt wrote:



Just off hand, are there not too many time parameters?

  

Probably, I just threw in some * to fill in extra ones.
I was just trying to show that I was purposefully running at a 
certain time during testing.

Too lazy to count them correctly :)




So how many asterisks are in your crontab?  An extra * will attempt to 
run every file in current directory.  Your script files wouldn't 
happen to be in the default directory would they?




$ crontab -l
#minute hourmdaymonth   wdaycommand

57  3   *   *   *   mv /home/chris/vprod* 
/home/chris/psqldump/
46  2   *   *   *   /usr/local/bin/pg_dump -U ben -d 
prod | gzip  /home/chris/prod_dump`date +\%m\%d\%Y`.sql.gz

03  3   *   *   1   /home/chris/LWP4.pl;
03  4   *   *   1   /home/chris/LWP5.pl;
33  4   *   *   1   /home/chris/LWP_lowes10.pl;
03  5   *   *   1   /home/chris/LWP6.pl;
03  6   *   *   1   /home/chris/LWP_hd.pl;
03  7   *   *   1   /home/chris/LWP_lowes11.pl;
30  *   *   *   *   /home/chris/LWP4.pl; 
/home/chris/LWP5.pl; /home/chris/LWP6.pl;


I don't have the original line from crontab that I used.
I decided to try this again, as you can see on the last line.
THIS time, all is running normally!

At the time, only those three scripts (and one that would have done 
nothing) were present in the default directory.


It does seem likely now that I may have gotten the number of * wrong.
I am very careful with editing crontabs, I can see that I need to be 
even more careful. Running all the scripts could be very bad!


Thanks,
Chris Bennett



cron problem

2009-07-02 Thread Chris Bennett

I had an odd problem with cron.

I made three perl scripts: LWP4.pl, LWP5.pl and LWP6.pl

During testing, I put the following entry in cron:

33   *   *   *   *   *   LWP4.pl; LWP5.pl; LWP6.pl;


When it ran, I got 6 versions of each of these scripts running 
concurrently and in order also.
They didn't start at exact same time, but as if LWP4.pl, then another 
and another, etc.


When first version of LWP4.pl finished, then first version of LWP5.pl etc.

These scripts get a web page, extract values from matches, update 
database, sleep, repeat for new pages until done with list of search values.



Chris Bennettf



Re: cron problem

2009-07-02 Thread Randal L. Schwartz
 Chris == Chris Bennett ch...@bennettconstruction.biz writes:

Chris During testing, I put the following entry in cron:

Chris 33   *   *   *   *   *   LWP4.pl; LWP5.pl; LWP6.pl;


Chris When it ran, I got 6 versions of each of these scripts running 
concurrently
Chris and in order also.

If the total time to run the three scripts in sequence is greater than an
hour, you will get overlapping runs.

If you don't want that, you should put some sort of highlander (there can
be only one!) locking in your scripts.  I addressed this subject in
my column at: http://www.stonehenge.com/merlyn/WebTechniques/col54.html

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion



Re: cron problem

2009-07-02 Thread Robert
On Thu, 02 Jul 2009 10:27:46 -0500
Chris Bennett ch...@bennettconstruction.biz wrote:

 I had an odd problem with cron.
 
 I made three perl scripts: LWP4.pl, LWP5.pl and LWP6.pl
 
 During testing, I put the following entry in cron:
 
 33   *   *   *   *   *   LWP4.pl; LWP5.pl; LWP6.pl;
 
 
 When it ran, I got 6 versions of each of these scripts running 
 concurrently and in order also.
 They didn't start at exact same time, but as if LWP4.pl, then another 
 and another, etc.
 
 When first version of LWP4.pl finished, then first version of LWP5.pl
 etc.
 
 These scripts get a web page, extract values from matches, update 
 database, sleep, repeat for new pages until done with list of search
 values.
 
 
 Chris Bennettf

Hi,

The command in cron is executed by the defined $SHELL.
The semicolon means run each part after one another, without caring for
the exitstatus of the previous.
With ksh you'd want to connect the parts with a single ampersand so
they are executed in the background.
Just have a look at the manpage for whatever shell you use in that
crontab.

- Robert



Re: cron problem

2009-07-02 Thread steve szmidt
On Thursday 02 July 2009, Chris Bennett wrote:
 I had an odd problem with cron.

 I made three perl scripts: LWP4.pl, LWP5.pl and LWP6.pl

 During testing, I put the following entry in cron:

 33   *   *   *   *   *   LWP4.pl; LWP5.pl; LWP6.pl;


 When it ran, I got 6 versions of each of these scripts running
 concurrently and in order also.
 They didn't start at exact same time, but as if LWP4.pl, then another
 and another, etc.

 When first version of LWP4.pl finished, then first version of LWP5.pl etc.

 These scripts get a web page, extract values from matches, update
 database, sleep, repeat for new pages until done with list of search
 values.


 Chris Bennettf

Just off hand, are there not too many time parameters?

-- 

Steve Szmidt

They that would give up essential liberty for temporary safety 
deserve neither liberty nor safety.
Benjamin Franklin



Re: cron problem

2009-07-02 Thread Chris Bennett

steve szmidt wrote:



Just off hand, are there not too many time parameters?

  

Probably, I just threw in some * to fill in extra ones.
I was just trying to show that I was purposefully running at a certain 
time during testing.

Too lazy to count them correctly :)

Running these solo in separate entries works fine.

That will work fine, but I do want to clearly understand what the error 
was caused by.
Thinking about it, I got 6 duplicates and the sleep was set for 10 secs. 
60 secs in one minute.

60/10 = 6. Coincidence?

The total time to run all three alone, added up to less than an hour but 
more than a few minutes


The 'highlander' suggestion sounds useful.

Chris Bennett


--
A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.
  -- Robert Heinlein



Re: cron problem

2009-07-02 Thread Frank Bax

Chris Bennett wrote:

I had an odd problem with cron.

I made three perl scripts: LWP4.pl, LWP5.pl and LWP6.pl

During testing, I put the following entry in cron:

33   *   *   *   *   *   LWP4.pl; LWP5.pl; LWP6.pl;




Too many asterisks?



Re: cron problem

2009-07-02 Thread Stuart Henderson
On 2009-07-02, Chris Bennett ch...@bennettconstruction.biz wrote:
 steve szmidt wrote:


 Just off hand, are there not too many time parameters?

   
 Probably, I just threw in some * to fill in extra ones.
 I was just trying to show that I was purposefully running at a certain 
 time during testing.
 Too lazy to count them correctly :)

If you're asking people to spend their time helping you, please give
people the information they need by copy and pasting correctly..



Re: cron problem

2009-07-02 Thread Frank Bax

Chris Bennett wrote:

steve szmidt wrote:



Just off hand, are there not too many time parameters?

  

Probably, I just threw in some * to fill in extra ones.
I was just trying to show that I was purposefully running at a certain 
time during testing.

Too lazy to count them correctly :)




So how many asterisks are in your crontab?  An extra * will attempt to 
run every file in current directory.  Your script files wouldn't 
happen to be in the default directory would they?