linux - How to kill a shell script and processes it created? -


i run shell script inside php (using shell_exec). want kill , processes created when in operation. know shell script pid. have suggestion? using ubuntu, php apache module.

thank you.

example:

#!/bin/bash echo hello sleep 20 

when kill script (shell_exec("sudo kill -9 $pid")), sleep process not killed not desired.

use

pkill -term -p pid 

will kill child processes

see this answer


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -