ps: Clean way to only get parent processes?

后端 未结 9 775
忘了有多久
忘了有多久 2020-12-15 00:28

I use ps ef and ps rf a lot.

Here is a sample output for ps rf:

  PID TTY      STAT   TIME COMMAND
 3476 pts/0         


        
9条回答
  •  悲&欢浪女
    2020-12-15 01:03

    Why do not you simply save the pid of the master in a file (pidfile) with the --pidfile option ? If it is not a viable solution you can give a custom name to the master process with --procname-master .

    Using ps for that kind of things is highly unreliable (race conditions all over the place, and special cases invalidating parsing rules...)

提交回复
热议问题