Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

kill cron

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
Kill port 443 - Hello All, I'm running RedHat 8.0 and Apache 2.0.40. *Very* little of # cat | grep Listen shows I've only it to listen on port 80. # netstat -an shows that port 443 is open for all..

cron adduser - Hi, creating a .php <? exec( ) ?> and called by cron as root does not create a user. What can i change to make it work?? thx for idears.

Howto Stop/Restart/Kill Tomcat After It failed starting? - Hello, Is there any way to Tomcat after it failed starting due to wrong etc....? I.E. I changed settings in and needed to restart Tomcat to apply the change. It failed. Doing service tomcat4 stop or

rotateing logs on demand / from cron - Maybe I just the wheel, but I couldn't find an easy way to do this. All I wanted to do was rotate my apache logs at midnight Sunday, so I could have weekly logs. If it's of any use to anyone else I have put my patch here:..

RUTHLESSLY KILL PSYCHOPATHS BUSH, RUMSFELD, CHENEY, Robert.. - FBI PUSSIES went and a 14 yr old WHITE girl pulling her from her classroom in for posting a picture with title on her myspace website. But here, I POSTED
Next:  Custom server variable  
Author Message
Séverin_Richard

External


Since: Jul 30, 2007
Posts: 8



(Msg. 1) Posted: Sat Oct 27, 2007 7:58 am
Post subject: kill cron
Archived from groups: alt>apache>configuration (more info?)

Hi all,

How can i kill a cron process with a 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.

 >> Stay informed about: kill cron 
Back to top
Login to vote
Rik Wasmus

External


Since: Oct 16, 2007
Posts: 3



(Msg. 2) Posted: Sun Oct 28, 2007 12:35 am
Post subject: Re: kill cron [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sat, 27 Oct 2007 13:19:43 +0200, Séverin Richard
<severin.richard.DeleteThis@free.fr> wrote:

> Hi all,
>
> How can i kill a cron process with a 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...

I'm not directly aware of a method, but another way would be:
- either let the PHP script check the time itself (if it can take 5
minutes, usually a loop/while construct is involved somewhere, which would
be a very handy place to let the script die if it takes to long).
<?php
$time = time();
....
while($data){
if((time()-$time) > 300) exit;
//do some processing
}

- or let the PHP script set a flag in a file or database indicating it's
busy, and let it remove it when it finishes. On a start, it would check
wether another one was still busy and die() if another job was still
running.
--
Rik

 >> Stay informed about: kill cron 
Back to top
Login to vote
shimmyshack

External


Since: Jun 07, 2007
Posts: 70



(Msg. 3) Posted: Sun Oct 28, 2007 10:58 am
Post subject: Re: kill cron [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 27, 10:35 pm, "Rik Wasmus" <u....TakeThisOut@tfwasmus.enschedenet.nl>
wrote:
> On Sat, 27 Oct 2007 13:19:43 +0200, Séverin Richard
>
>
>
> <severin.rich....TakeThisOut@free.fr> wrote:
> > Hi all,
>
> > How can i kill a cron process with a 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...
>
> I'm not directly aware of a method, but another way would be:
> - either let the PHP script check the time itself (if it can take 5
> minutes, usually a loop/while construct is involved somewhere, which would
> be a very handy place to let the script die if it takes to long).
> <?php
> $time = time();
> ...
> while($data){
> if((time()-$time) > 300) exit;
> //do some processing
>
> }
>
> - or let the PHP script set a flag in a file or database indicating it's
> busy, and let it remove it when it finishes. On a start, it would check
> wether another one was still busy and die() if another job was still
> running.
> --
> Rik

normally it doesnt mater how long a job runs for when using cron, it
is just a way to start them off. This suggest some issue with your
implementation - there are cron classes in a few of the larger open
source projects around, i think wordpress has one. there might be some
code you code reuse there if your project can allow this.

what kind of jobs are we talking here, since php appears to have the
rights to execute them are we talking image resizing etc... in this
case Rik is right, why not just handle the jobs through a job handler
which uses some logic (database + ps grepping and PID), so that the
server gets round to doing them sequentially, and can also prioritise
importnat jobs and jumpo them up the queue, no need for cron restarts.
Also you dont have the problem of multiple intensive jobs tying up
your CPU when they could have been "niced" and run sequentially.
 >> Stay informed about: kill cron 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]