ยง2023-08-31

If you like to tell a process is finished at remote, for eample make -j4

[alexlai@hc4Gentoo ~]$ pgrep make
254964
256241
277470
293392
343125
344810
345280
347758
[alexlai@hc4Gentoo ~]$ ps 254964
    PID TTY      STAT   TIME COMMAND
 254964 tty1     S+     0:00 make -j4

In the output you provided, the STAT column displays the status of the process. In this case, the status is S+. Here's what it means:

The combination of S and + indicates that the process is currently waiting for an event to complete and is also associated with the terminal. In this case, it seems that the make process (PID 254964) is still actively running and waiting for something, possibly I/O operations or other subprocesses to complete.

SO, if I can not get anyhting from ps 254964 then it is done. ChatGPT

[alexlai@hc4Gentoo ~]$ ps 256241
    PID TTY      STAT   TIME COMMAND
 256241 tty1     S+     0:00 make -f ./scripts/Makefile.build obj=. need-builtin=1 need-modorder=1
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 256241
 254964
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 277470
 256241
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 293392
 256241
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 343125
 277470
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 344810
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 345280
[alexlai@hc4Gentoo ~]$ ps -o ppid= -p 347758
[alexlai@hc4Gentoo ~]$ ps 254964
    PID TTY      STAT   TIME COMMAND
 254964 tty1     S+     0:00 make -j4
[alexlai@hc4Gentoo ~]$ ps 347758         <-- finished
    PID TTY      STAT   TIME COMMAND