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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-11-2016, 12:10 PM
|
#1
|
LQ Newbie
Registered: Jan 2015
Posts: 10
Rep: 
|
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.
|
|
|
10-11-2016, 12:26 PM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,952
|
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.
|
10-11-2016, 02:43 PM
|
#3
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,739
|
"watch" can do that
Code:
watch -n 2 -t "ps -aef | grep frmweb >> frmweb.txt"
|
|
1 members found this post helpful.
|
10-12-2016, 07:49 AM
|
#4
|
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
|
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.
|
|
|
10-12-2016, 03:04 PM
|
#5
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
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 01:57 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|