Saturday 15 August 2015

bash - run a process from script and kill it from another script using PID -


I want to execute a process from the script and kill it with the second script using PID. I can think of two things but I think that you can help me more effectively in doing this. First of all, upload a PID in a temporary file and read it from the second script. The other way is to save it from the first script as the environment variable and use it with the other script. I am pretty sure that this is a good way to do that I use killall and pkill to kill the process by the name of the process Done However, this did not work well. I want to kill it using PID.

Creating a temporary .pid file with information on the process Track PID of a running process There is a very common way to do It is easy to do in most languages ​​and is very simple.

The second problem can arise because depending on the shell you use, this environment variable can be difficult to ensure that it is not global and touch. / P>

No comments:

Post a Comment