LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-07-2017, 03:13 AM   #1
smunir362
LQ Newbie
 
Registered: Jan 2015
Posts: 10

Rep: Reputation: Disabled
Linux process per user detail


Hi,
I want to make a report daily in linux server.

Date: 07-Mar-2017

Time root oracle grid mikle pegasus all
12:10 200 500 200 20 34 954
12:20 201 --
12:30 190
-- --
-- --
23:50 210

Actually I need count the process per user after each 10 minutes.
 
Old 04-07-2017, 03:20 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,576

Rep: Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341Reputation: 4341
http://www.linuxquestions.org/questi...gs-4175464257/
 
1 members found this post helpful.
Old 04-07-2017, 03:33 AM   #3
smunir362
LQ Newbie
 
Registered: Jan 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
I want to
list per user processes (required)
total processes after every 10 minutes (sar provide)

with sar or something like utility
 
Old 04-07-2017, 03:37 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
If you are happy with something basic then top can do this, if you need it to run every 10 minutes then that sounds like a cronjob.

Code:
$ top -bn 1 | tail -n +8 | awk '{print $2}' | sort | uniq -c
      2 avahi
     52 -------
      1 chrony
      1 colord
      1 dbus
      1 libstor+
      1 nobody
      1 polkitd
      2 postfix
      5 qemu
    228 root
      1 rpc
      1 rpcuser
      1 rtkit
      1 sshd
of course this is only catching the actual number of existing processes every 10 minutes rather than getting the amount of processes created over that 10 minutes.
 
1 members found this post helpful.
Old 04-07-2017, 09:29 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,870
Blog Entries: 27

Rep: Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662
Try

Code:
ps A -u [username or number]
See man ps for more.

Last edited by frankbell; 04-07-2017 at 09:36 PM.
 
Old 04-08-2017, 01:05 AM   #6
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Some ideas:
spend some time studying the `ps -o` options (to get exactly the info you want) >file
Use text tools like sort, wc, cut or more advanced awk/sed, to format that file as you desire.
Then, either put code in crontab, or a script that has a loop with `sleep 600`

Spend some time playing with web-searches to find the optimal keywords; start with: sar tutorial

My current favorite LQadvice (please spend time reading it! skip #1 about homework):
http://www.linuxquestions.org/questi...ml#post5669556

Let us (&future searchers!) know... Best wishes; feel free to post any specific problems you encounter, using
[CODE]
[/CODE]
tags!

Last edited by Jjanel; 04-08-2017 at 01:07 AM.
 
Old 04-08-2017, 10:24 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,844

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
I THINK you want the bsd accounting packages installed.

This will allow you to collect the exit statuses of processes, user logins, logouts in accounting files, then you can run reports extracting the information in different ways.

Depending on distribution the accounting packages have different names, so you will have to lookup what your distribution names them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL6 login process in detail mysilverkey Linux - Newbie 2 06-20-2013 07:45 PM
Keep Alive Process In Detail Questions dman777 Linux - Networking 1 07-12-2012 05:09 AM
Detail of Automount process Pr_009 Fedora 1 02-27-2006 05:59 AM
I want to know a little detail about linux start process. liyuefu Linux - General 4 08-15-2005 11:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration