0

We need to create a service to log User Process Usage Start Time and End Time along with username (Excluding the system level process). Sometime, the user maybe super user, so we need to log LoggedIn user or the super user. When the process get exited need to update the end time.

Need to write to a file like below.

UserName;ProcessID;ProcessName;StartTime;EndTime

I am new to shell script. Please help.

  • First off, to help we'll need a bit more information. What system do you need to obtain this information for (Linux, Windows server, other)? Second, what shell scripting language were you planning on using? Third, have you looked into programs, this is 99% likely to be a solved problem, and there's very little sense in reinventing the wheel? – NickW Aug 06 '20 at 12:32
  • Thanks for the reply. OS - Ubunut 20.04. The shell scripting need to use is bash. I have looked in to the command ps and history. But I don't know hot to get. whoami returns "root" instead of the user name. – Babu Kumarasamy Aug 07 '20 at 11:33
  • Right, so the first thing to do would be to update your question, but also, have a look at this: https://serverfault.com/questions/336217/how-do-i-log-every-command-executed-by-a-user to start. – NickW Aug 12 '20 at 13:24

0 Answers0