954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Calculate the amount of time in the linux process using perl script

Hello all!

Can somebody help me write a perl script which totals the total amount of time that each user is using on the system, as well as the number of processes the user is using.

As example:
The output of your program would be the following:

root 00:01:18 13
ananias 00:00:00 1
dias 00:00:00 1
peter 00:00:00 1

flory
Newbie Poster
4 posts since Jul 2004
Reputation Points: 11
Solved Threads: 0
 

>Can somebody help me write a perl script which totals the total amount of time that each user is using on the
>system, as well as the number of processes the user is using.
Pipe the result of a call to ps through your script and parse it, saving the items you want and calculating your totals. ps is different for every system, so do a man ps and when you have more information and you've actually made an attempt, come back and we can help more.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You