LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-11-2016, 01:10 PM   #1
smunir362
LQ Newbie
 
Registered: Jan 2015
Posts: 10

Rep: Reputation: Disabled
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.
 
Old 10-11-2016, 01:26 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,456
Blog Entries: 13

Rep: Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774Reputation: 3774
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.
 
1 members found this post helpful.
Old 10-11-2016, 03:43 PM   #3
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,476
Blog Entries: 3

Rep: Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234Reputation: 2234
"watch" can do that

Code:
watch -n 2 -t "ps -aef | grep frmweb >> frmweb.txt"
 
1 members found this post helpful.
Old 10-12-2016, 08:49 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware FreeBSD Win10 MX
Posts: 9,658

Rep: Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085Reputation: 2085
something like this
Code:

if [pgrep -u $USER frmweb ] ; then
 "ps -aef | grep frmweb >> frmweb.log"
fi
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.
 
Old 10-12-2016, 04:04 PM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,445
Blog Entries: 9

Rep: Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670Reputation: 3670
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Giving wrong output with sh but correct output with command entry in Ubuntu bison72 Linux - Newbie 3 10-15-2015 12:27 AM
Requests to my ISP server are output in the middle of output by any command I run. stf92 Slackware 2 07-10-2012 09:38 AM
[SOLVED] Bash; awk or sed output to variable: how keep newline at end of each output line porphyry5 Programming 3 06-10-2011 06:50 PM
Standard script output to screen & -x option output to file BoBeau236 Programming 6 05-10-2011 08:43 AM
the sound gives output when using mic but no output when run a music file medo Debian 0 04-19-2004 08:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration