Sponsored Content
Top Forums Shell Programming and Scripting How to calculate time difference between start and end time of a process! Post 302450482 by kchinnam on Thursday 2nd of September 2010 10:56:01 PM
Old 09-02-2010
I do not have GNU date. So I got frustrated with limited options to get elapsed time in Unix,, I wrote a method in Java and using it..
If this works I could replace java method with this..

Code:
diffTime=`expr ${endTime} - ${startTime}`

Does this approach work if a main program is calling say 1. common functions included from other ksh programs and 2. included java programs(from jar/class) ? I know PID is same thrughout the execution of my program.

In other words can we use this to reliably find elapsed time to execute complex Admin scripts in Unix ?

say my environment variable is this
Quote:
SECONDS=1111
: once I execute abc.sh Does it start incrementing SECONDS as soon as any PID starts in the runtime and ends incrimenting before that PID exits from shell !?

Last edited by kchinnam; 09-03-2010 at 12:03 AM.. Reason: more doubts..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Start time/end time and status of crontab job

Is there anyway to get the start time and end time / status of a crontab job which was just completed? Of course, we know the start time of the crontab job since we are scheduling. But I would like to know process start and time recorded somewhere or can be fetched from a command like 'ps'. ... (3 Replies)
Discussion started by: thambi
3 Replies

2. Shell Programming and Scripting

How to calculate this time difference

Hi, Please help me in calculating the time difference between below mentioned timestamps. a=07/17/2007 02:20:00 AM MST b=07/17/2007 02:07:46 AM MST Thanks (2 Replies)
Discussion started by: Prat007
2 Replies

3. Shell Programming and Scripting

How to calculate the time difference...

Hi All, I've written a script which reads all the systems backup information and saves it in a log file. ssh -l ora${sid} ${primaryhost} "tail -2 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" |head -1 | awk '{print echo "PREVIOUS:-- Start Date&Time: " $3,$4,echo "|| End Date&Time:... (1 Reply)
Discussion started by: suri.tyson
1 Replies

4. Shell Programming and Scripting

How to calculate the time difference.

Hi All, I've written a script which reads all the systems backup information and saves it in a log file. ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" | awk '{print $3,$4,$5,$6}' >> ${RESULTFILE} The output comes as below: 2008-09-30 06.00.01... (2 Replies)
Discussion started by: suri.tyson
2 Replies

5. Shell Programming and Scripting

How to get data between the start time and end time?

Hi, Can anyone help me how can I get the line that between the start time and end time. file1.txt 15/03/2009 20:45:03 Request: - Data of this line 15/03/2009 20:45:12 Response: - Data of this line 15/03/2009 22:10:40 Request: - Data of this line 15/03/2009 22:10:42 Response: - Data of... (1 Reply)
Discussion started by: tanit
1 Replies

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

7. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

8. Shell Programming and Scripting

Calculate time difference

I have time in a file in HH:MM:SS format as it contents(its not the file creation time). i need this to be converted to epoch time or time since 1970. The time is written into that file by a script, which i cannot modify. Im using AIX machine $ cat abc.txt 10:29:34 (2 Replies)
Discussion started by: gpk_newbie
2 Replies

9. Shell Programming and Scripting

Calculate time difference between two lines

i grepped the time stamp in a file as given below now i need to calculate time difference file data: 18:29:10 22:15:50 (5 Replies)
Discussion started by: vivekn
5 Replies
GIJ(1)									GNU								    GIJ(1)

NAME
gij - GNU interpreter for Java bytecode SYNOPSIS
gij [OPTION] ... JARFILE [ARGS...] gij [-jar] [OPTION] ... CLASS [ARGS...] [-Dname[=value]...] [-ms=number] [-mx=number] [--showversion] [--version] [--help] DESCRIPTION
"gij" is a Java bytecode interpreter included with "libgcj". "gij" is not available on every platform; porting it requires a small amount of assembly programming which has not been done for all the targets supported by gcj. The primary argument to "gij" is the name of a class or, with "-jar", a jar file. Options before this argument are interpreted by "gij"; remaining options are passed to the interpreted program. If a class name is specified and this class does not have a "main" method with the appropriate signature (a "static void" method with a "String[]" as its sole argument), then "gij" will print an error and exit. If a jar file is specified then "gij" will use information in it to determine which class' "main" method will be invoked. "gij" will invoke the "main" method with all the remaining command-line options. Note that "gij" is not limited to interpreting code. Because "libgcj" includes a class loader which can dynamically load shared objects, it is possible to give "gij" the name of a class which has been compiled and put into a shared library on the class path. OPTIONS
-Dname[=value] This defines a system property named name with value value. If value is not specified then it defaults to the empty string. These system properties are initialized at the program's startup and can be retrieved at runtime using the "java.lang.System.getProperty" method. -ms=number This sets the initial heap size. -mx=number This sets the maximum heap size. -jar This indicates that the name passed to "gij" should be interpreted as the name of a jar file, not a class. --help Print help, then exit. --showversion Print version number and continue. --version Print version number, then exit. SEE ALSO
gcc(1), gcj(1), gcjh(1), jv-scan(1), jcf-dump(1), gfdl(7), and the Info entries for gcj and gcc. COPYRIGHT
Copyright (C) 2001, 2002 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being ``GNU General Public License'', the Front- Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the man page gfdl(7). gcc-3.2.2 2003-02-25 GIJ(1)
All times are GMT -4. The time now is 10:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy