Ps -eo user,pid,ppid,nice,etime,tty,time,args \ And I don't know how to tell printf "just format the first few args, and put everything else as-is in the last %s")Īdding back-in the regular ps 'time' would be quite some work, as it have 1 or 2 columns whether the process is dated of more or less than 24h, and the spacing would become all wrong again, and the last sed would fail, etc. I will do that sometime later! (but I fear that long args lines may mess things up. maybe I should just do simple things and process it all via a simpler printf to realign?. or $0 recomputes the whole line, I can't easily keep the alignement. (I would use awk if I could, but as changing anything on $1, $2. The convoluted sed (like the last one) try to keep the alignement (and the output is more aligned than what ps does). Ps_output_prettifier="%10s %8s %8s %3s %-14s %11s %10s %s\n" #11s for /dev/pts, as it could also be "zoneconsole" in a solaris zone. thanks to it having a weird way of changing the number of information it displays.) max_size_var_awk="399" #old awk (and nawk) limit of a var size ?! but is really ugly ^^Įdit: New version (a bit saner, and versatile, but still show you need to process ps output a lot to get something usable. The little thing below takes care of those cases (and more). ps have a little shift for etime having days>99. Some defunct process have either no time, or have also no username, nor pty, nor time.(or differ between solaris & aix, or different versions of those). Also, I think it already fails on machines where processes last for more than 999 days. (but may fail when something changes in the future. Just for the laughs, here is what I had to do on some ancient systems (both aix and solaris), and it seems just about "ok" up to now.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |