The date construct in UNIX can be used to calculate when something is finished: date -v+1H displays the time 1 hour from now.
I want to use the same construct in a script, but it is leading to error messages:
where $duration is calculated based on input variables. Perhaps someone can tell me what construct to use?
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
I tried the construct
in Linux, Solaris, aix, and hpux without success.
However, if your UNIX allows such usage, I suggest specifying the variable in such a construct in this form:
that is, curly braces to avoid the ambiguity of a variable named durationH as opposed to duration followed by an H.
Best wishes ... cheers, drl
PS It is always useful to post the error message so that we have a better chance of helping you.
PPS I see that FreeBSD will accept that construct, and the suggested change worked correctly for me.
Last edited by drl; 04-18-2009 at 08:07 AM..
Reason: Added Postscripts
16:45:51 10051 77845
16:45:51 10051 77845
16:46:52 10051 77846
16:46:53 10051 77846
Match the last PID then subtract second line time with first line.
Please help me with any command or script.
working in media company on a project OS: RHEl7
tried command:
awk 'function... (2 Replies)
Hi All,
I want to run a utility for all the process id that are running for more than 15 mins.
I have captured process id's and the time that they were run in a file like below
1st column represnts the process ids and the 2nd one is the Time
<
21014 01:00
21099 01:00
24361 01:03
24406... (5 Replies)
Hi All,
I have written script and wanted to know the run time of it in seconds. i used below logic but am not getting the results in second instead getting error.
cat pkloader.sh
# if you want to calculate the time in milliseconds then use $(date +%s%N)
START_TIME=`date +%s`
echo... (2 Replies)
Hey all. I am working on some scripts in bash to perform a variety of functions; there are a variety of steps involved, and they must happen in a specific sequence; what I need help with is a way to calculate some differences in a timestamp in a logfile.
One of the steps in the scripts I am... (3 Replies)
Hi All,
I have the following time stamp data in 2 columns
Date TimeStamp(also with milliseconds)
05/23/2012 08:30:11.250
05/23/2012 08:30:15.500
05/23/2012 08:31.15.500
.
.
etc
From this data I need the following output.
0.00( row1-row1 in seconds)
04.25( row2-row1 in... (5 Replies)
A report needs to come some what similar to this
No of elements Stream Batch No Load time
A B C D
A,B,C im able to get quite easily
wc -l /usr/local/intranet/areas/prod/output/SRGW_0?/*/MESSAGE_T.dat
O/P of above command.
A B C ... (1 Reply)
Dear Folks,
I want to calculate the elapsed hours between two time columns. I am using timestampdiff method for the same. I am able to get the value. But facing an issue of decimal values. For example the elapsed hours between 09:00:00 and 20:30:00 is coming as 11 instead of 11.5. I am using below... (1 Reply)
how can we identify the task completion time which was initiated by CRON.
we have 1000 of jobs whihc are runing from cron so it is not feasable to edit every cron entry or every script to add the respective code to find teh completion time.
Can some one please provide a inut to find the task... (3 Replies)
Hi,
I am having the following problem.
test > hourOfDay=06 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime
180
test > hourOfDay=07 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime
120
test > hourOfDay=08 ; delayTime=$(((9-$hourOfDay)*60)) ; echo $delayTime
bash: (9-08: value... (5 Replies)
I've been trying all night to come up with a script that will take a file that contains job completion times like this as input:
18:30
17:45
16:39
18:01
17:50
...
and figure the Average completion time. I've tried several things, and I just can't seem to get it to figure correctly. I'm... (5 Replies)