kill process based on file name

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

kill process based on file name

Post by ddragas »

how to kill process based on file name that runs process. I'm on shared server (cpanel = fantastico)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Most hosts running cpanel don't let you kill processes.

What is the actual problem you are trying to solve?
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Hi Feyd and thank you for reply.

Here is what I need

I'm building system that is submitting certain type of data with some servers, and for that I'm using SMPP protocol ( http://www.smsforum.net/SMPP_v3_4_Issue1_2.zip ), which I have already written (by myself) in php. Now when I connect with server and start to exchange data, everything is fine until I want to disconnect myself from server. In other words I have to connect on server, send data, remain connected for 5 more minutes (in case more data comes) and then disconnect from server.

Until now I've menage to connect and send / receive data from / to server, but I can not disconnect my self from it.


That is why I need to kill process to be able to disconnect myself from server.

All suggestions are appreciated.


Kind regards


ddragas
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

what it sounds like you want to do is this:

Code: Select all

// remove the script timeout
set_time_limit (0);

// enter your loop
while(1){

   // check to see if you're finished
   if($task_complete){
      // clean up and...
      die;
   }

   // look for input, send output

   // set a sleep delay so your script doesn't take over the server
   usleep(200);

}
Does that pretty much sum it up?
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

yes - and this is prity much what am I doing right now, only in the middle of exchanging data id "enquire link" command that keeps connection up.

But I wan't to be able to kill process for any reason. Want to have controll over it. Like STOP button in factory in case of emergency :)

Is there any way so I can kill process ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have your script check a value from an external source (like a database.) Then be able to set it from a separate page request.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

...and make sure to be nice to your HD and use a HEAP table.
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

thank you both for reply

You folks always find a good solution on solving things

have a nice day


regards

ddragas
Post Reply