Sponsored Content
Top Forums Shell Programming and Scripting execution time / runtime -- bash script please help! Post 302364948 by Scrutinizer on Saturday 24th of October 2009 04:29:46 PM
Old 10-24-2009
Ow that is right I tested it in ksh93. Bash can't deal with that.

Alternatively:
Code:
res1=$(date +%s.%N)
sleep 1
res2=$(date +%s.%N)
echo "Start time: $res1"
echo "Stop time:  $res2"
echo "Elapsed:    $(echo "$res2 - $res1"|bc )"

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script execution time calculation

I am writting a script in the ksh shell and am trying to find a way to report the total execution time of the script without requiring the user to specify the time function when executing the script. Does anyone have any examples they have used. I have been setting up two date variables (one at... (9 Replies)
Discussion started by: johnsonbryce
9 Replies

2. AIX

allocate memory for shell script at runtime during execution--urgent critical help!!

How to allocate memory for a shell script on aix box at the time of execution i.e at runtime Are there any commands for AIX in specific Thanks in Advance (1 Reply)
Discussion started by: aixjadoo
1 Replies

3. Shell Programming and Scripting

time of execution of script

i want to test whether a script has been executed in last 15 days or not....please help how can i do this...is there any copmmand there to know timings of last execution of any script (8 Replies)
Discussion started by: arghya_owen
8 Replies

4. Shell Programming and Scripting

get execution time of a script

Hi, I have a simple question. How can I get the execution time of a script and maybe put it in a variable? Another question. How can I get only time and not date and put it in a variable? I tried something with "date" command but with no success... If someone could help me... (8 Replies)
Discussion started by: Moumou
8 Replies

5. UNIX for Dummies Questions & Answers

script start and end of execution of time

Hi All, Can we get to know the start time and end time of execution of a script? (This script doesn't write any logs.) I mean, is there any built in process logs to track these records? (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

6. Shell Programming and Scripting

Runtime informations - bash script

Hello, I'm running a bash script and I'd like to get more accurate a runtime information then now. So far I've been using this method: STARTM=`date -u "+%s"` ......... *script function.... ......... STOPM=`date -u "+%s"` RUNTIMEM=`expr $STOPM - $STARTM` if (($RUNTIMEM>59)); then... (3 Replies)
Discussion started by: TehOne
3 Replies

7. AIX

Java Runtime Execution require reboot of pSeries server regularly?

Dear all experts, Recently the daily batch run process (run using Java Runtime Execution)suddenly run slow. Our apps vendor came in and check and request to reboot the server. After rebooting of the server, the batch run back to normal. May I know is periodically rebooting of pSeries server is a... (9 Replies)
Discussion started by: kwliew999
9 Replies

8. Shell Programming and Scripting

Find execution time of script

i am using bash START=$(date +%s) END=$(date +%s) DIFF=$(echo "$END - $START" ) this code is not working (14 Replies)
Discussion started by: rafa_fed2
14 Replies

9. Shell Programming and Scripting

Optimizing script to reduce execution time

AFILENAME=glow.sh FILENAME="/${AFILENAME}" WIDTHA=$(echo ${FILENAME} | wc -c) NTIME=0 RESULTS=$(for eachletter in $(echo ${FILENAME} | fold -w 1) do WIDTHTIMES=$(awk "BEGIN{printf... (5 Replies)
Discussion started by: SkySmart
5 Replies

10. Shell Programming and Scripting

To take script execution time

Hello Guys, I would like to know is there a way to take the script execution time For e.g i am having a script.sh i need to write inside he script.sh like Start time : 10-Mar-2016 02:30:35 all code over here ... End time : 10-Mar-2016 03:30:32 Script start time - 02:30:35 ... (7 Replies)
Discussion started by: Master_Mind
7 Replies
PG_SEND_QUERY(3)														  PG_SEND_QUERY(3)

pg_send_query - Sends asynchronous query

SYNOPSIS
bool pg_send_query (resource $connection, string $query) DESCRIPTION
pg_send_query(3) sends a query or queries asynchronously to the $connection. Unlike pg_query(3), it can send multiple queries at once to PostgreSQL and get the results one by one using pg_get_result(3). Script execution is not blocked while the queries are executing. Use pg_connection_busy(3) to check if the connection is busy (i.e. the query is executing). Queries may be cancelled using pg_cancel_query(3). Although the user can send multiple queries at once, multiple queries cannot be sent over a busy connection. If a query is sent while the connection is busy, it waits until the last query is finished and discards all its results. PARAMETERS
o $connection - PostgreSQL database connection resource. o $query - The SQL statement or statements to be executed. Data inside the query should be properly escaped. RETURN VALUES
Returns TRUE on success or FALSE on failure. Use pg_get_result(3) to determine the query result. EXAMPLES
Example #1 pg_send_query(3) example <?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); if (!pg_connection_busy($dbconn)) { pg_send_query($dbconn, "select * from authors; select count(*) from authors;"); } $res1 = pg_get_result($dbconn); echo "First call to pg_get_result(): $res1 "; $rows1 = pg_num_rows($res1); echo "$res1 has $rows1 records "; $res2 = pg_get_result($dbconn); echo "Second call to pg_get_result(): $res2 "; $rows2 = pg_num_rows($res2); echo "$res2 has $rows2 records "; ?> The above example will output: First call to pg_get_result(): Resource id #3 Resource id #3 has 3 records Second call to pg_get_result(): Resource id #4 Resource id #4 has 1 records SEE ALSO
pg_query(3), pg_cancel_query(3), pg_get_result(3), pg_connection_busy(3). PHP Documentation Group PG_SEND_QUERY(3)
All times are GMT -4. The time now is 09:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy