LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 12: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, 12:26 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,952
Blog Entries: 13

Rep: Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984Reputation: 4984
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, 02:43 PM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,739
Blog Entries: 4

Rep: Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968Reputation: 3968
"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, 07:49 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243Reputation: 2243
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, 03:04 PM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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-14-2015 11:27 PM
Requests to my ISP server are output in the middle of output by any command I run. stf92 Slackware 2 07-10-2012 08: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 05:50 PM
Standard script output to screen & -x option output to file BoBeau236 Programming 6 05-10-2011 07:43 AM
the sound gives output when using mic but no output when run a music file medo Debian 0 04-19-2004 07:17 PM

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

All times are GMT -5. The time now is 01:57 PM.

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
Open Source Consulting | Domain Registration