-   Linux - Newbie (
-   -   Linux ps output (

smunir362 10-11-2016 12:10 PM

Linux ps output
I use following command.
ps -aef|grep frmweb >> frmweb.txt
Actually I want to store output in continuous manner.
like whenever a new frmweb process created save in file...

How can i do that.

rtmistler 10-11-2016 12:26 PM

Brute force is that you can write a script with a delay which performs that ps command and keeps things up to date.

Is frmweb a standard binary, or your own binary? Note that processes created have their process ID stored in the /proc file system.

It would help to understand what your real intentions are if they are beyond monitoring. For instance if you wish to kill all existing processes at some point, or some other thing you wish to do.

Turbocapitalist 10-11-2016 02:43 PM

"watch" can do that


watch -n 2 -t "ps -aef | grep frmweb >> frmweb.txt"

BW-userx 10-12-2016 07:49 AM

something like this

if [pgrep -u $USER frmweb ] ; then
 "ps -aef | grep frmweb >> frmweb.log"

check to see if frmweb is running first, if yes log it, not tested. slap it into a job for minutes or if daily then shell script add to cron.daily make executable.

ondoho 10-12-2016 03:04 PM

the ps command is very powerful.
i know for a fact that you can save the "|grep frmweb" by reading "man ps".
maybe it even has an option for continuous output?

All times are GMT -5. The time now is 05:24 PM.