给进程添加固定的PID值

Jun*_*ior 2 process debian

我需要将我的进程的 PID 编号设置为固定值,因为在满足某些条件时我需要用我的应用程序杀死它,是否可以这样做?

SHW*_*SHW 5

AFAIK。不可能将特定的 PID 分配给任何程序,但您可以通过几种方式保存程序的 PID 值

a. pidof PROGRAM_NAME => It will give you PID of that program
b. PROGRAM_NAME & PID_NO=$! => It will save PID of program into PID_NO variable
Run Code Online (Sandbox Code Playgroud)