PHP kill cron

Hi all,

How can i kill a cron process at the begining of my cron task (php script):


My cron task starts evry 5 minutes,
but may work more than this time. (no timeout configured on my server
for cron tasks (?).


I guess if i can stop every process of this task before starting it again.


my task looks like:
usr/local/bin/php -q -f /home/mypass/cron.php

then php script cron starts...


THX for ,idears.
severin [ Sa, 27 Oktober 2007 13:16 ] [ ID #1855943 ]

Re: PHP kill cron

Séverin Richard wrote:
> Hi all,
>
> How can i kill a cron process at the begining of my cron task (php script):

Easy way is to do a killall (see the man page how to use it), of course
this would kill the current process too.

A more advanced is to have a process list (file) where you store the
process number each time that a script is run, the script then kills all
the processes in the list except its own, clear out the processes it has
killed.


> My cron task starts evry 5 minutes,
> but may work more than this time. (no timeout configured on my server
> for cron tasks (?).

Time out is for web servers only, if you want to do a time out thing in
cli scripts, then you need to build it yourself into your scripts.



--

//Aho
Shion [ Sa, 27 Oktober 2007 15:18 ] [ ID #1855944 ]

Re: PHP kill cron

Séverin Richard:

> How can i kill a cron process at the begining of my cron task (php
> script):

Why should you schedule crons tasks thru a php script rather than directly
in the crontab?
Floor
Floor [ Sa, 24 November 2007 13:02 ] [ ID #1877953 ]
PHP » alt.php » PHP kill cron

Vorheriges Thema: Studying php
Nächstes Thema: qmail queue from php