Translate a UNIX User ID to a Real Name

This short script is helpful when you're looking at the OnLine logfile trying to find out why something strange has happened. In the logfile, OnLine will tell you that a certain PID (process identifier) owned by a certain user has caused a problem. For example, the following two lines appeared in a logfile just before the database aborted and crashed:

11:42:24 Process Aborted Abnormally: pid=26630 user=129 us=e0002bf0 flags=l
11:42:24 Process Aborted Abnormally (latch): pid=26630 user=129 flags=l

Here, a backend, process ID #26630, was killed by user #129 at 11:42 while holding a latch, causing the system to abort. To find the name of user 129, run the following script, called username:

INFORMIX  73> cat username
grep $1 /usr/passwd | awk -F: ' {printf("The culprit is %s, aka: %s
",$1,$5))'

Feel free to change the "culprit....etc." to your favorite pejorative comments. The script is invoked as username user_number, for example, username 129.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.58.169