HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Script or command to find amount of real time ...
Operating System - Linux
1827892
Members
1703
Online
109969
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2008 09:35 AM
06-12-2008 09:35 AM
Script or command to find amount of real time for a process
Is there a command to find the amount of real time a process has been running?
Or does anyone have a script example to find this information?
Trying to write a script to look for processes that have been running greater than or equal to 12 hours.
Or does anyone have a script example to find this information?
Trying to write a script to look for processes that have been running greater than or equal to 12 hours.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2008 09:46 AM
06-12-2008 09:46 AM
Re: Script or command to find amount of real time for a process
Hi:
If you use the XPG4 (UNIX95) mode of 'ps' you can output your time in 'days-hours:minutes:seconds'. This field is then easy to parse for computation purposes.
Compare these:
# ps -ef |grep xntpd
root 1671 1 0 Mar 3 ? 28:28 /usr/sbin/xntpd -x
...versus:
# UNIX95= ps -e -o pid -o etime -o comm|grep xntpd
1671 100-18:59:40 xntpd
Set the UNIX95 variable *only* for the duration of the 'ps' command as shown. There is no semicolon after the assignment operator and before the 'ps'.
If you don't want headings added to the output, do:
# UNIX95= ps -e -o pid= -o etime= -o comm=
See the manpages for 'ps' for more information.
Regards!
...JRF...
If you use the XPG4 (UNIX95) mode of 'ps' you can output your time in 'days-hours:minutes:seconds'. This field is then easy to parse for computation purposes.
Compare these:
# ps -ef |grep xntpd
root 1671 1 0 Mar 3 ? 28:28 /usr/sbin/xntpd -x
...versus:
# UNIX95= ps -e -o pid -o etime -o comm|grep xntpd
1671 100-18:59:40 xntpd
Set the UNIX95 variable *only* for the duration of the 'ps' command as shown. There is no semicolon after the assignment operator and before the 'ps'.
If you don't want headings added to the output, do:
# UNIX95= ps -e -o pid= -o etime= -o comm=
See the manpages for 'ps' for more information.
Regards!
...JRF...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP