thx Dennis ,
Yes. But if your file has data from hours and days ago, you might kill the wrong process, because PIDs are eventually reused -->
I will remove pid_file after it kill the process , the new pid_file will be generated if it is required to kill .
I would like to confirm you whether the logic is :
it first read all pid in pid_file (kill -0) , it try to kill it by "kill" , if successful to kill , then do nothing , if unsuccessful to kill , then try kill -INT , if still not success , then try kill -QUIT , if still not success , then mailx , is the logic correct ? thx