I have a script runs every 3 seconds by javascript refreshing. Sometimes that is crashing because some of older copies remain in memory and my server does not allowed rather than N runs of a script in one time. I want to bring out older copies of script from memory on first of every running of script. I can do it manually by KILL PROCESS in CPANEL but I am looking about an automatically solution.
Mind sharing how you kill processes using CPanel? As for your problem, the simplest solution would be to set the time limit of the script to 3 seconds so that they'll auto terminate.
http://www.php.net/manual/en/function.shell-exec.php#57215 http://www.google.com/search?q=kill+process+in+PHP -- Remember Google is you friend!
That guy said he uses CPANEL. exec is a php function. kill is a unix command Both are usually disable in shared hosting.