RE: [PHP] question about a cron job

2005-01-17 Thread Jay Blanchard
[snip]
I've got a question about the following cronjob.

 
 #At 3:01 our time, run backups
 1 0 * * * /usr/local/bin/php
/www/r/rester/htdocs/auto_backup/back_em_up.php
/www/r/rester/htdocs/auto_backup/cron.log 21
 
 #At 3:02 clean up sessions folder
 2 0 * * * (find /www/r/rester/htdocs/sessions/ -name 'sess_*' -mtime
+1 -delete)
 
 #this is only for testing a new cronjob, every minute
 * * * * * /usr/local/bin/php
/www/r/rester/htdocs/phpList_cronjob/process_cronjob.php
/www/r/rester/htdocs/phpList_cronjob/cron.log 21
 

The new one doesn't seem to want to run until after 3:01 or 3:02.
Shouldn't the 
sever just run it every minute?
[/snip]

You have to specify each minute...

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about a cron job

2005-01-17 Thread Al
Jay Blanchard wrote:
[snip]
I've got a question about the following cronjob.

#At 3:01 our time, run backups
1 0 * * * /usr/local/bin/php
/www/r/rester/htdocs/auto_backup/back_em_up.php
/www/r/rester/htdocs/auto_backup/cron.log 21
#At 3:02 clean up sessions folder
2 0 * * * (find /www/r/rester/htdocs/sessions/ -name 'sess_*' -mtime
+1 -delete)
#this is only for testing a new cronjob, every minute
* * * * * /usr/local/bin/php
/www/r/rester/htdocs/phpList_cronjob/process_cronjob.php
/www/r/rester/htdocs/phpList_cronjob/cron.log 21

The new one doesn't seem to want to run until after 3:01 or 3:02.
Shouldn't the 
sever just run it every minute?
[/snip]

You have to specify each minute...
http://www.unixgeeks.org/security/newbie/unix/cron-1.html

I thought the * in the minutes position meant to run the script for all 
minutes, 0 59.

Am I wrong?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] question about a cron job

2005-01-17 Thread Erwin Kerk
Al wrote:
I've got a question about the following cronjob.
#At 3:01 our time, run backups
1 0 * * * /usr/local/bin/php 
/www/r/rester/htdocs/auto_backup/back_em_up.php 
/www/r/rester/htdocs/auto_backup/cron.log 21

#At 3:02 clean up sessions folder
2 0 * * * (find /www/r/rester/htdocs/sessions/ -name 'sess_*' -mtime 
+1 -delete)

#this is only for testing a new cronjob, every minute
* * * * * /usr/local/bin/php 
/www/r/rester/htdocs/phpList_cronjob/process_cronjob.php 
/www/r/rester/htdocs/phpList_cronjob/cron.log 21

The new one doesn't seem to want to run until after 3:01 or 3:02.  
Shouldn't the sever just run it every minute?

And, the every minute job doesn't add anything to its log file.
Apache on a virtual host.  The 3:01 and 3:02 jobs have been running fine 
for months.

Thanks
The CRON daemon only refreshes it's job list after a job in the current 
list is completed. Therefore, the CRON daemon won't notice the 
every-minute job until 3.01 pm.

Erwin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] question about a cron job

2005-01-17 Thread Michael Sims
 #this is only for testing a new cronjob, every minute
 * * * * * /usr/local/bin/php
 /www/r/rester/htdocs/phpList_cronjob/process_cronjob.php
 /www/r/rester/htdocs/phpList_cronjob/cron.log 21


 The new one doesn't seem to want to run until after 3:01 or 3:02.
 Shouldn't the
 sever just run it every minute?

Yes, it should.  Cron normally emails any output (including messages to stderr) 
to
the owner of the cron job.  In this case you have 21 at the end of your 
command
which should be 21.  On my machine executing a command with 21 results 
in:

-bash: syntax error near unexpected token `'

which might explain why your job isn't running.  If I setup a test job that 
looks
similar to yours, the above error output is emailed to me.

Jay Blanchard wrote:
 You have to specify each minute...

* * * * * is sufficient for that.  I've got a couple of jobs on a box here 
that
run every minute and that's the way they are entered in my crontab...

HTH

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about a cron job

2005-01-17 Thread Al
Erwin Kerk wrote:
Al wrote:
I've got a question about the following cronjob.
#At 3:01 our time, run backups
1 0 * * * /usr/local/bin/php 
/www/r/rester/htdocs/auto_backup/back_em_up.php 
/www/r/rester/htdocs/auto_backup/cron.log 21

#At 3:02 clean up sessions folder
2 0 * * * (find /www/r/rester/htdocs/sessions/ -name 'sess_*' -mtime 
+1 -delete)

#this is only for testing a new cronjob, every minute
* * * * * /usr/local/bin/php 
/www/r/rester/htdocs/phpList_cronjob/process_cronjob.php 
/www/r/rester/htdocs/phpList_cronjob/cron.log 21

The new one doesn't seem to want to run until after 3:01 or 3:02.  
Shouldn't the sever just run it every minute?

And, the every minute job doesn't add anything to its log file.
Apache on a virtual host.  The 3:01 and 3:02 jobs have been running 
fine for months.

Thanks
The CRON daemon only refreshes it's job list after a job in the current 
list is completed. Therefore, the CRON daemon won't notice the 
every-minute job until 3.01 pm.

Erwin
Wow, that is a key point and makes sense.  Boy, I read several refs about 
cronjobs and not one of them mentioned this.

So, if I put my 1 minute job first in the list, all should be well?
Thanks..
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] question about a cron job

2005-01-17 Thread Bret Hughes
On Mon, 2005-01-17 at 09:01, Erwin Kerk wrote:
 Al wrote:
  I've got a question about the following cronjob.
  
 
  #At 3:01 our time, run backups
  1 0 * * * /usr/local/bin/php 
  /www/r/rester/htdocs/auto_backup/back_em_up.php 
  /www/r/rester/htdocs/auto_backup/cron.log 21
 
  #At 3:02 clean up sessions folder
  2 0 * * * (find /www/r/rester/htdocs/sessions/ -name 'sess_*' -mtime 
  +1 -delete)
 
  #this is only for testing a new cronjob, every minute
  * * * * * /usr/local/bin/php 
  /www/r/rester/htdocs/phpList_cronjob/process_cronjob.php 
  /www/r/rester/htdocs/phpList_cronjob/cron.log 21
 
  
  The new one doesn't seem to want to run until after 3:01 or 3:02.  
  Shouldn't the sever just run it every minute?
  
  And, the every minute job doesn't add anything to its log file.
  
  Apache on a virtual host.  The 3:01 and 3:02 jobs have been running fine 
  for months.
  
  Thanks
  
 
 The CRON daemon only refreshes it's job list after a job in the current 
 list is completed. Therefore, the CRON daemon won't notice the 
 every-minute job until 3.01 pm.
 

I am not sure I read that correctly.  Are you saying that the job cannot
be running for the new crontab to be installed?  If so, I could see that
althought I have never experienced it.  

If you are saying that each job in the crontab must be run before the
new crontab is completed, then I believe you are in error.  I have often
changed crontab entries to test how a job will operate in the cron
environment and never experienced any delay on the acceptance of the new
job even though I have hourly and daily jobs there.

Bret

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] question about a cron job

2005-01-17 Thread Michael Sims
Erwin Kerk wrote:
 The CRON daemon only refreshes it's job list after a job in the
 current list is completed. Therefore, the CRON daemon won't notice the
 every-minute job until 3.01 pm.

I'm not sure I understand what you're saying above.  Can you provide a pointer 
to
documentation about this?  The man page for Vixie cron states in part:

Additionally, cron checks each minute to see if its spool directory's modtime 
(or
the modtime on /etc/crontab)  has changed,  and  if  it  has, cron will then 
examine
the modtime on all crontabs and reload those which have changed.  Thus cron 
need not
be restarted whenever a crontab file is modified.

Vixie cron, at least, refreshes it's job list anytime a crontab is changed, and
keeps that job list until the next change is made.  Jobs should run according to
their way they are scheduled, and shouldn't be affected by the order they are 
listed
in the crontab or when other jobs are completed.

Perhaps I'm not understanding what you're saying (if so, my apologies) or 
perhaps
you are using a different flavor of cron that behaves differently.  I really 
only
have experience with Vixie cron, but I thought they all pretty much behaved the 
same
way...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about a cron job

2005-01-17 Thread Jason Wong
On Monday 17 January 2005 23:19, Al wrote:
 Erwin Kerk wrote:
  Al wrote:
  The CRON daemon only refreshes it's job list after a job in the current
  list is completed. Therefore, the CRON daemon won't notice the
  every-minute job until 3.01 pm.

Not sure if I've misunderstood what Al is saying but, the cron daemon checks 
all crontabs for updates *every* minute. So at the most, 2 minutes after 
you've updated your crontab the changes will take effect.

 Wow, that is a key point and makes sense.  Boy, I read several refs about
 cronjobs and not one of them mentioned this.

 So, if I put my 1 minute job first in the list, all should be well?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about a cron job

2005-01-17 Thread Jochem Maas
Michael Sims wrote:
Erwin Kerk wrote:
The CRON daemon only refreshes it's job list after a job in the
current list is completed. Therefore, the CRON daemon won't notice the
every-minute job until 3.01 pm.

I'm not sure I understand what you're saying above.  Can you provide a pointer 
to
documentation about this?  The man page for Vixie cron states in part:
Additionally, cron checks each minute to see if its spool directory's modtime 
(or
the modtime on /etc/crontab)  has changed,  and  if  it  has, cron will then 
examine
the modtime on all crontabs and reload those which have changed.  Thus cron 
need not
be restarted whenever a crontab file is modified.
say you change the crontab (do a save) in minute 2:49pm, then the file 
will be checked and reloaded, by the time that thats complete it will be 
passed 3:00:00pm (or more precisely after the jobtrigger was run), maybe 
what was meant was; that the 'everyminute' job would therefore trigger 
for the first time when cron checks jobs on 3:01:00pm?

Vixie cron, at least, refreshes it's job list anytime a crontab is changed, 
and
keeps that job list until the next change is made.  Jobs should run according to
their way they are scheduled, and shouldn't be affected by the order they are 
listed
in the crontab or when other jobs are completed.
Perhaps I'm not understanding what you're saying (if so, my apologies) or 
perhaps
you are using a different flavor of cron that behaves differently.  I really 
only
have experience with Vixie cron, but I thought they all pretty much behaved the 
same
way...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] question about a cron job

2005-01-17 Thread Michael Sims
Jochem Maas wrote:
 Michael Sims wrote:
 Additionally, cron checks each minute to see if its spool
 directory's modtime (or the modtime on /etc/crontab)  has changed,
 and  if  it  has, cron will then examine the modtime on all crontabs
 and reload those which have changed.  Thus cron need not be
 restarted whenever a crontab file is modified.

 say you change the crontab (do a save) in minute 2:49pm, then the file
 will be checked and reloaded, by the time that thats complete it will
 be passed 3:00:00pm (or more precisely after the jobtrigger was run),
 maybe what was meant was; that the 'everyminute' job would therefore
 trigger for the first time when cron checks jobs on 3:01:00pm?

Oh, I see.  At any rate, once it starts running at 3:01 it should then run every
minute from that point forward until it's removed from the crontab.  I'm not 
sure
that the OP was getting that point.  (BTW, I think you meant 2:59pm unless 
you've
got some really slow transfer rates on your hard drives. :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about a cron job

2005-01-17 Thread Al
Michael Sims wrote:
Erwin Kerk wrote:
The CRON daemon only refreshes it's job list after a job in the
current list is completed. Therefore, the CRON daemon won't notice the
every-minute job until 3.01 pm.

I'm not sure I understand what you're saying above.  Can you provide a pointer 
to
documentation about this?  The man page for Vixie cron states in part:
Additionally, cron checks each minute to see if its spool directory's modtime 
(or
the modtime on /etc/crontab)  has changed,  and  if  it  has, cron will then 
examine
the modtime on all crontabs and reload those which have changed.  Thus cron 
need not
be restarted whenever a crontab file is modified.
Vixie cron, at least, refreshes it's job list anytime a crontab is changed, and
keeps that job list until the next change is made.  Jobs should run according to
their way they are scheduled, and shouldn't be affected by the order they are 
listed
in the crontab or when other jobs are completed.
Perhaps I'm not understanding what you're saying (if so, my apologies) or 
perhaps
you are using a different flavor of cron that behaves differently.  I really 
only
have experience with Vixie cron, but I thought they all pretty much behaved the 
same
way...
What you said has been my experience in the past.  But, it has been a long time 
since I fiddled with a cron job, so I wasn't certain of my memory.

Here is my code; but it doesn't run.  I can't tell if there is anything wrong 
with my crontab or my virtual webhost is faulty.

#this is only for testing a new cronjob, every minute. This job replaces its 
log and error files.
* * * * * /usr/local/bin/php /www/r/rester/htdocs/phpList_cronjob/process_cronjob.php 
/www/r/rester/cronjob_reports/phpList.log 
2/www/r/rester/cronjob_reports/phpList.err
#At 3:01 our time, run backups. This job replaces its log and error files.
1 0 * * * /usr/local/bin/php /www/r/rester/htdocs/auto_backup/back_em_up.php 
/www/r/rester/cronjob_reports/auto_backup.log 
2/www/r/rester/cronjob_reports/auto_backup.err
There is a cronjob_reports folder.  I am assuming that the  will create the 
  log and err files as needed.

Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] question about a cron job

2005-01-17 Thread Jochem Maas
Michael Sims wrote:
Jochem Maas wrote:
Michael Sims wrote:
Additionally, cron checks each minute to see if its spool
directory's modtime (or the modtime on /etc/crontab)  has changed,
and  if  it  has, cron will then examine the modtime on all crontabs
and reload those which have changed.  Thus cron need not be
restarted whenever a crontab file is modified.
say you change the crontab (do a save) in minute 2:49pm, then the file
will be checked and reloaded, by the time that thats complete it will
be passed 3:00:00pm (or more precisely after the jobtrigger was run),
maybe what was meant was; that the 'everyminute' job would therefore
trigger for the first time when cron checks jobs on 3:01:00pm?

Oh, I see.  At any rate, once it starts running at 3:01 it should then run every
minute from that point forward until it's removed from the crontab.  I'm not 
sure
that the OP was getting that point.  (BTW, I think you meant 2:59pm unless 
you've
typo.
they did this people skills thing once at a company I worked for, and 
one of the things they did was to get people to close the eye for 
exactly 1 minute, I sat there for about 2mins - everyone thought it was 
very funny. guess I've slowed down (and become more eratic) with age ;-)

got some really slow transfer rates on your hard drives. :)
or I have a php script designed to hog exactly 99% of all resources for 
no reason :-) for ten minutes, set in cron to run every hour at 49 mins 
past. hihi


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php