Skip to content

Small utility program to get the process start time on AIX. Can be used to reliably determine the last boot time by getting the start time of PID 1.

Notifications You must be signed in to change notification settings

Josholith/getProcStartTime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

getProcStartTime utility for AIX

https://stackoverflow.com/a/23815755/1680777

How to compile this program:

gcc getProcStartTime.c -o getProcStartTime

Here's the magic logic: AIX just like Linux has a process called init with PID 1. It can't be killed or restarted. So the start time of PID 1 is the boot time of your server.

./getProcStartTime 1

On my server, it returns Wed Apr 23 10:33:30 2014; yours will be different.

Note, I originally made getProcStartTime specifically for this purpose, but now I use it in all kinds of other scripts. Want to know how long an Oracle database has been up? Find the PID of Oracle's PMON and pass that PID as your arg after getProcStartTime.

If you really want the output as an integer number of seconds, it would be an easy programming exercise to modify the code above. The name getProcUptime is just a suggestion. Then you could just call:

./getProcUptime 1

About

Small utility program to get the process start time on AIX. Can be used to reliably determine the last boot time by getting the start time of PID 1.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published