I am needing to do some debugging work, and as a part of that debugging work I need to know if there are any processes still running after a user session has logged out. And I need to specifically be able to also tell to which user those processes belong to. It would also be useful for me to be able to log the processes still active during as much of the shutdown process as possible.
I have already tried for instance to log which processes are still active after a certain user session logs out by having an admin account active at the same time as another account, so that while the other account is logging out the admin account will be logging the process activity with:
top > ~/top.txt
But there were two problems with that, firstly it would not allow for me to tell anything about the processes which are active during the shutdown process (well as much of it as I could log before the logging process gets terminated), and secondly the output into the text file was unreadable for me because most lines looked something like this:
And although I can pick this apart and by looking at an actual example of top
running in my CLI, I can tell what some bits are, but it's really hard to tell with what I have got to do, plus I don't know at which points what happened, I don't know if one of the outputs in the file is before the log out, or after, or some point during, and it is just really hard to read.
So I am wondering if there is a way to better achieve what I am trying to achieve? And if anybody could give me any suggestions on maybe how I could improve my methods, or suggest some new methods.
I was thinking about perhaps running a logging script as root automatically, but as well as it being a bit of a possible security risk, it would probably give me the same scrambled output as I got from top
before. Please let me know if you need any more information.
OS Information:
Description: Ubuntu 14.10
Release: 14.10
top
, use batch mode:top -b
.