Sponsored Content
Top Forums Shell Programming and Scripting ps showing inconsistent process start time Post 302376846 by jstrangfeld on Wednesday 2nd of December 2009 12:15:43 PM
Old 12-02-2009
Question 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 script auditing each process and its startup time sticking it into a file and diffing it against the previous iteration of the same script, if they are different I send an email to inform the support team "hey foo restarted on this server". Naturally if a process flip flops like this I generate inaccurate emails.

Only a couple of processes show the below behavior I don't believe its related to the process but some oddity how ps works.

Anyone have an idea what the cause may be?

All the bellow are within a few seconds of each others:

Code:
[root@foo ~]# ps -e -www -o stime,cmd |grep foo|grep -v grep |awk '{print $NF,$1}'
foo 01:21
[root@foo ~]# ps -e -www -o stime,cmd |grep foo|grep -v grep |awk '{print $NF,$1}'
foo 01:21
[root@foo ~]# ps -e -www -o stime,cmd |grep foo|grep -v grep |awk '{print $NF,$1}'
foo 01:21
[root@foo ~]# ps -e -www -o stime,cmd |grep foo|grep -v grep |awk '{print $NF,$1}'
foo 01:20
[root@foo ~]# ps -e -www -o stime,cmd |grep foo|grep -v grep |awk '{print $NF,$1}'
foo 01:20
[root@foo ~]# ps -e -www -o stime,cmd |grep foo|grep -v grep |awk '{print $NF,$1}'
foo 01:21

[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:20 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:20 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:20 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:21 foo
[root@foo ~]# ps -aef |grep foo|grep -v grep |awk '{print $5,$NF}'
01:20 foo

[root@foo ~]# ps auxwww |grep foo|grep -v grep |awk '{print $9,$NF}'
01:21 foo
[root@foo ~]# ps auxwww |grep foo|grep -v grep |awk '{print $9,$NF}'
01:21 foo
[root@foo ~]# ps auxwww |grep foo|grep -v grep |awk '{print $9,$NF}'
01:20 foo
[root@foo ~]# ps auxwww |grep foo|grep -v grep |awk '{print $9,$NF}'
01:20 foo
[root@foo ~]# ps auxwww |grep foo|grep -v grep |awk '{print $9,$NF}'
01:21 foo

[root@foo ~]# ps -aef |grep foo |grep -v grep|awk '{print $2}'
17857
[root@foo ~]# ls -l /proc/ |egrep 17857
dr-xr-xr-x   5 foo foo           0 Dec  2 01:20 17857

[root@dxpomsagt06 ~]# uname -a
Linux foo 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:33:05 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux


Last edited by pludi; 12-02-2009 at 01:48 PM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. Solaris

How to get process start date and time in SOLARIS?

how can I get the process start date and time? using ps command i can get the timstamp for a process, which are started today. and only date (MMM DD) for others. i need to get both for all the running process. please help. Regards, Jagadeeswaran.K (7 Replies)
Discussion started by: Jagadeeswaran.K
7 Replies

8. 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

9. 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

10. 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
JAVA-WRAPPERS(7)						   Java wrappers						  JAVA-WRAPPERS(7)

NAME
java-wrappers - capacities shared by java wrapper scripts DESCRIPTION
Most Java programs are not run directly, but through small shell scripts that take care of various things, such as finding a suitable java environment and looking for libraries. To ease the task of the maintainers, they rely on a library providing runtime detection, library detection and other features. This manual page describes the common features of all those scripts, and to which point you can configure them. This is mainly done via environment variables. ENVIRONMENT VARIABLES
java-wrappers understands some environment variables: JAVA_CMD The java command that will be run. If this variable is set, it disables all lookup for a java runtime. JAVA_BINDIR Specifies a directory that will be looked for a java or a jdb executable (depending on the setting of JAVA_DEBUGGER). It has prece- dence over JAVA_HOME but not over JAVA_CMD. JAVA_HOME A path to a java runtime. If this variable is set, all lookup for a java runtime is disabled, except that if no java executable is found in the path, the command java is used. JAVA_FLAVOR A probably more easy-to-use version of the JAVA_HOME variable: instead of specifying the full path of the java runtime, you name it. List of available flavors can be found in the file /usr/lib/java-wrappers/jvm-list.sh. See examples below. JAVA_DEBUGGER If this is set, the wrapper will try to pick up a java debugger rather than a java interpreter. This will fail if the jbd of the runtime found is a stub. JAVA_CLASSPATH Additional classpath, will have priority over the one found by the wrapper. JAVA_ARGS Additional arguments to the java command. They will come before all other arguments. FORCE_CLASSPATH If this variable is set, it will be the only classpath. You'd better know what you are doing. DEBUG_WRAPPER This is probably the most important variable; if it set, the wrapper will print out useful information as it goes by its business, such as which runtime it did find, and which command is run eventually. JAVA_JARPATH The path where the wrappers will go looking for jar archives. If not set, the wrapper will look into the default directory, /usr/share/java. Warning : the wrapper will not look anywhere else than in JAVA_JARPATH. Setting it incorrectly will most probably result in early crashes. EXAMPLES
The examples all rely on rasterizer(1), from the package libbatik-java, but they really apply to all scripts that use java-wrappers. Print out debugging information: DEBUG_WRAPPER=1 rasterizer Limit rasterizer's memory to 80 MB: JAVA_ARGS=-Xmx80m rasterizer Force rasterizer to run with kaffe(1): JAVA_HOME=/usr/lib/kaffe rasterizer The same, but using JAVA_BINDIR: JAVA_BINDIR=/usr/lib/kaffe/bin rasterizer Force rasterizer to run with openjdk: JAVA_FLAVOR=openjdk rasterizer Debug rasterizer with Sun's debugger, while printing debugging information from the wrapper: DEBUG_WRAPPER=1 JAVA_CMD=/usr/lib/jvm/java-6-sun/bin/jdb rasterizer BUGS
Care has been taken to make the wrappers bug-free. If that was not the case, please file a bug report against the java-wrappers package. If you wish to submit any problem with a java executable relying on java-wrappers, please also submit the output of the command run with DEBUG_WRAPPER=1. It will save one mail exchange and therefore potentially reduce the time it takes to fix the bug. DEVELOPERS
There is currently no documentation about writing a wrapper script save the comments in /usr/lib/java-wrappers/java-wrappers.sh. If you have to write one, we suggest you base yourself upon, for instance, the rasterizer wrapper script, or any other one (just pick up any direct reverse dependency of java-wrappers and look for scripts). SEE ALSO
java(1), jdb(1) /usr/lib/java-wrappers/java-wrappers.sh AUTHOR
java-wrappers and its documentation were written by Vincent Fourmond <fourmond@debian.org> Version 0.1.16 2010-05-04 JAVA-WRAPPERS(7)
All times are GMT -4. The time now is 05:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy