I want to get information about a specific process automatically. I can get these infos from the /proc/PID/status file. But my problem is that the process that I want to get its info could take no time to execute . If I have a program named foo, when I want to get its info, I use this command :
./foo | cat /proc/`/sbin/pidof foo`/status
BUT the program foo takes no time to execute. Consequently, when I try to search for its info, the directory /proc/`/sbin/pidof foo` is already removed.
So my question is : How can I pause the program foo, until I can get its info, then kill foo ?