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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Do we have generic solution get process start time in AIX & Linux
# 1  
Old 11-21-2019
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:

Code:
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.
# 2  
Old 11-21-2019
Please run the same command on both systems (AIX and Linux):

cat /proc/<your_test_pid>/stat

and post back some sample output.
# 3  
Old 11-21-2019
Quote:
Originally Posted by Neo
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:

Code:
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

# 4  
Old 11-21-2019
"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.

Moderator's Comments:
Mod Comment Reader do not want to decode and guess your situation. That is why we ask for full information. We are ALL busy people. When you post a question seeking help, provide full information. This is for the benefit of all current and future users who are seeking answers to their questions. When you post here for help, you do so with the obligation to post in a manner which helps other who may have the same question in the future. That is the purpose of the site, to help many people, not only one. Everyone should be able to understand the questions and the answers. This is the mission of UNIX.com. Knowledge for everyone, even the beginners.
# 5  
Old 11-21-2019
The following Posix options are available on many OS:
Code:
ps -p <pid> -o stime=

But the format of stime is not standardized.
Better is the elapsed time
Code:
ps -p <pid> -o etime=

where the format is
Code:
[[d-]hh:]mm:ss

Note: the =header extension sets a custom header, and no header if empty (just =).
This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

2. UNIX for Dummies Questions & Answers

how to get start time of a running process

I am trying to see if a process is running what was its start time. here is the code that I am using if then echo 'Gateway output processing started.' else VAR=$(ps -ef | grep batch_output_x ) ... fi now the problem i see is when the process is running i get two... (3 Replies)
Discussion started by: akabir77
3 Replies

3. Shell Programming and Scripting

ps showing inconsistent process start time

Not sure if it makes a difference but "foo" is a java process. The start time reported by various flavors of ps seems to be flopping back and forth by a minute. I have many (a few hundred) "foo" like processes which tend to be somewhat unstable and get restarted somewhat frequently, I wrote a... (2 Replies)
Discussion started by: jstrangfeld
2 Replies

4. Linux

Process start time not showing correct time

Process start time is not showing the correct time: I had started a process on Jun 17th at 23:30:00. Next day morning when I run the command "ps -ef | grep mq", the process is showing the start date of Jun 17th but the start time is 00:16:41 Day/Date is setup correctly on the server. It... (2 Replies)
Discussion started by: hemangjani
2 Replies

5. HP-UX

HP UX start process at boot time

When I get start program at boot I read which run level /sbin/rcx.d runlevel=0.....x only read directory which directory name has UpperCase 'S' is not enough someone says that I need to reference another file which file I need to reference 1)/etc/rc.config.d/all file which parameter... (4 Replies)
Discussion started by: alert0919
4 Replies

6. UNIX for Dummies Questions & Answers

start process at assidned date and time

How can I start FTP at assigned DATE and TIME? (6 Replies)
Discussion started by: gd2003
6 Replies

7. UNIX for Advanced & Expert Users

start time of a terminated process

Hi, I have a shell script which i am running. I want it's starting time (the time when the execution of the shell script started) in another shell script. Note that the process has already terminated when i need it's starting time.... else i could have used ps -f | cut -d" " -f5... But that's... (2 Replies)
Discussion started by: k_chaaya
2 Replies

8. UNIX for Advanced & Expert Users

to get process start date and time

what is command to get same using ps with switch. I know process id, by specify process id. It should work on solaris and hp-ux I will be happy if for both different commands. (2 Replies)
Discussion started by: naeem ahmad
2 Replies

9. Programming

get process start time

Hi all, I like to know how can I get currenlty running process start time and date , I know only porcess id in solaris and hp-ux and what is command to get same using ps with switch. Thanks Naeem (1 Reply)
Discussion started by: naeem ahmad
1 Replies

10. UNIX for Advanced & Expert Users

start a process at boot up time

Hi, I have a program that check the IP address and automatic update it to the DNS server. I would like to run this program when the computer bootup after pppd get a connection. How do I add it to the init file. Does any one have any information of how to do it. I run a Linux Mandrake as a... (1 Reply)
Discussion started by: vtran4270
1 Replies
Login or Register to Ask a Question