Sponsored Content
Top Forums Shell Programming and Scripting How to calculate time difference between start and end time of a process! Post 302450443 by felipe.vinturin on Thursday 2nd of September 2010 03:55:50 PM
Old 09-02-2010
Do you need it in HHMMSS format?

If not, you can check the environment variable called: ${SECONDS}
Code:
startTime=${SECONDS}
# Do some stuff here
endTime=${SECONDS}
diffTime=`expr ${endTime} - ${startTime}`
echo "Diff Time: [${diffTime}]"

 

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
PYROMAN(8)						      System Manager's Manual							PYROMAN(8)

NAME
pyroman - a firewall configuration utility SYNOPSIS
pyroman [ -hvnspP ] [ -r RULESDIR ] [ -t SECONDS ] [ --help ] [ --version ] [ --safe ] [ --no-act ] [ --print ] [ --print-verbose ] [ --rules=RULESDIR ] [ --timeout=SECONDS ] [ safe ] DESCRIPTION
pyroman is a firewall configuration utility. It will compile a set of configuration files to iptables statements to setup IP packet filtering for you. While it is not necessary for operating and using Pyroman, you should have understood how IP, TCP, UDP, ICMP and the other commonly used Internet protocols work and interact. You should also have understood the basics of iptables in order to make use of the full functionality. pyroman does not try to hide all the iptables complexity from you, but tries to provide you with a convenient way of managing a complex networks firewall. For this it offers a compact syntax to add new firewall rules, while still exposing access to add arbitrary iptables rules. OPTIONS
-r RULESDIR,--rules=RULES Load the rules from directory RULESDIR instead of the default directory (usually /etc/pyroman ) -t SECONDS,--timeout=SECONDS Wait SECONDS seconds after applying the changes for the user to type OK to confirm he can still access the firewall. This implies --safe but allows you to use a different timeout. -h, --help Print a summary of the command line options and exit. -V, --version Print the version number of pyroman and exit. -s, --safe, safe When the firewall was committed, wait 30 seconds for the user to type OK to confirm, that he can still access the firewall (i.e. the network connection wasn't blocked by the firewall). Otherwise, the firewall changes will be undone, and the firewall will be restored to the previous state. Use the --timeout=SECONDS option to change the timeout. -n, --no-act Don't actually run iptables. This can be used to check if pyroman accepts the configuration files. -p, --print Instead of running iptables, output the generated rules. -P, --print-verbose Instead of running iptables, output the generated rules. Each statement will have one comment line explaining how this rules was generated. This will usually include the filename and line number, and is useful for debugging. CONFIGURATION
Configuration of pyroman consists of a number of files in the directory /etc/pyroman. These files are in python syntax, although you do not need to be a python programmer to use these rules. There is only a small number of statements you need to know: add_host Define a new host or network add_interface Define a new interface (group) add_service Add a new service alias (note that you can always use e.g. www/tcp to reference the www tcp service as defined in /etc/services) add_nat Define a new NAT (Network Address Translation) rule allow Allow a service, client, server combination reject Reject access for this service, client, server combination drop Drop packets for this service, client, server combination add_rule Add a rule for this service, client, server and target combination iptables Add an arbitrary iptables statement to be executed at beginning iptables_end Add an arbitrary iptables statement to be executed at the end Detailed parameters for these functions can be looked up by caling cd /usr/share/pyroman pydoc ./commands.py BUGS
None known as of pyroman-0.4 release AUTHOR
pyroman was written by Erich Schubert <erich@debian.org> SEE ALSO
iptables(8), iptables-restore(8) iptables-load(8) PYROMAN(8)
All times are GMT -4. The time now is 03:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy