LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-05-2007, 06:47 AM   #1
unkie888
Member
 
Registered: Aug 2007
Posts: 67

Rep: Reputation: 24
what/who started that process


Is there anyway in linux to know who/what started a process - AFTER that process has complete?
 
Old 11-05-2007, 07:49 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990

Rep: Reputation: 66
In general, no. Once a process has completed, it is removed from the kernel's process queues.

If the kernel held on to memory about processes after they had run then it would eventually run out of memory, not to mention the fact that you would run out of PID numbers very quickly.

While a process is running you can use the ps and pstree command to give you that kind of information; for more details see
Code:
man ps; man pstree
If you are interested in recording that kind of information then you could set up a cron job like this:
Code:
crontab -e
then add this line:
Code:
* * * * * sh -c "date; ps axo user,pid,ppid,tty,command" >> ~/ps.log
This will run once a second and append to the file ~/ps.log. You can then read it to see information about a particular process, including the PID, parent PID, user it's started by and terminal it's running on. But this will grow very big very fast, so you may want to either truncate the file periodically and/or run it less often at the risk of missing your process if it completes in less than a minute.
 
Old 11-05-2007, 08:05 AM   #3
unkie888
Member
 
Registered: Aug 2007
Posts: 67

Original Poster
Rep: Reputation: 24
thanks, i thought that.

the tip is kewl.
 
  


Reply

Tags
process


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how a father process know which child process send the signal SIGCHLD icoming Programming 10 07-20-2010 07:26 AM
to know how many users are there and killing some of process started remotely manoj111 Fedora 1 04-03-2007 02:16 PM
rsh started process don't generate core dumps llaswell Linux - Software 0 04-10-2006 11:46 AM
monitor processes to be notified when a new process is started? cfh Programming 2 10-03-2005 07:07 PM
If I want, that process has automatically started at system loading or reloading ukrainet Linux - Newbie 2 12-14-2004 09:39 AM


All times are GMT -5. The time now is 06:40 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration