Do we have generic solution get process start time in AIX & Linux

I wish to get the process start time on AiX and Linux using the same command / script.

I'm able to get the process start time in Linux using the below command:

cat /proc/<pid>/stat | grep Modify

The same does not work for AiX 6.1 systems.

Can you please let me know the command to get the start time for a process which works on both RedHat Linux 7.1 and AiX 6.1.

Please run the same command on both systems (AIX and Linux):

cat /proc/<your_test_pid>/stat

and post back some sample output.

stat file does not exists on AiX. There is a file called status but it is seems encrypted.

See below:

ls -ltr /proc/15598024/stat
/proc/15598024/stat not found
$>ls -ltr /proc/15598024/stat
/proc/15598024/stat not found
$>cat /proc/15598024/status
0   f       :*  î È 6 6   Ã   �'Î ¶5 ;  ' + OTHER   >xterm

"See below" (in your post above) is not really helpful for at least two reasons:

  1. You do not specific which lines are from which OS. Why omit this critical information? You just want all readers to guess? I asked for output from both servers. Did you provide that?
  2. You use the same PID on both servers.? How can that be correct? I am 99% sure the same exact PIDs do not exist on both servers at the same time. Ah.. you only provided HALF of what I asked for.

Why did you not reply to my question fully and accurately?

Please provide full, accurate, information to those whom who are seeking help.

Thanks.

1 Like

The following Posix options are available on many OS:

ps -p <pid> -o stime=

But the format of stime is not standardized.
Better is the elapsed time

ps -p <pid> -o etime=

where the format is

[[d-]hh:]mm:ss

Note: the =header extension sets a custom header, and no header if empty (just = ).

1 Like