I was just curious how can I run a script in the background I'd imainge I use the Shell_exec() function through PHP then find the PID and kill it when I need to? The reason I ask for is because the script could run for several days, but at the same time I will monitor its status through my administration section, but at the same time I want to be able to log out of my admin and come back the next day to check its status... How could I do this? I would need to kill it sooner or later...
shell_exec will do that since it can be used to run any system command. Run it using shell_exec (and add & to it to run in the background) then when you need to kill it, run any command like "ps ax | grep 'the file_name'", process the output to get the process ID and then kill it using shell_exec too.
Hmmm no but you can look for them one by one. 1. Run unix command in background 2. Run a unix command from php You will find it easy.