Sponsored Content
Full Discussion: Timing a script
Top Forums Shell Programming and Scripting Timing a script Post 302761525 by Don Cragun on Friday 25th of January 2013 08:23:49 PM
Old 01-25-2013
Using a recent Korn shell, the following seems to do what you want:
Code:
#!/bin/ksh
st=$SECONDS
 ... ... ...
if (( SECONDS - st > 60 ))
then    exit
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

timing a loop in unix.

hi guys.. i have a shell script that loops through a certain directory to see if a file has been created and then prints the file if it exists... the only problem i have now is that sometimes the flat does not get created by the program thats supposed to create it, in this scenario, my loop... (1 Reply)
Discussion started by: wolkott
1 Replies

2. Shell Programming and Scripting

HTML display timing problem under ksh script

Using a HTML page , i'm running a Unix ksh script with <a href=..>. The script contains loop like this : for i in do rsh..... done each rsh command is running quite long and then i would display results in HTML format but about 5mn my blank page waiting for result is running in error... (1 Reply)
Discussion started by: Nicol
1 Replies

3. UNIX for Advanced & Expert Users

scp timing out

having problems using scp in that during peak hours it appears to time out. anyone have similar experiences? any thoughts regarding a solution... (1 Reply)
Discussion started by: jph
1 Replies

4. Shell Programming and Scripting

Timing out a SSH

I need to make it so an autmated process which involves ssh, times out if ssh prompts for a password. Most of the time it shouldnt prompt for a password. But if it does i need it to time it out or get a status and stop the ssh and log that the ssh failed and move onto the next server. Is there any... (9 Replies)
Discussion started by: rcunn87
9 Replies

5. Programming

timing your functions

hi everyone. If you have a function created in your code and you want to find out how long it takes for it to run you can use a struct called gettimeofday(). so lets say we have a function like this int myfunction (int r) { /*some math calculations*/ return answer; } How do i set up... (3 Replies)
Discussion started by: bebop1111116
3 Replies

6. Programming

Help with __builtin_prefetch function and it's timing

Hello there, I just needed to know how to get the timing right when using the gcc __builtin_prefetch() function, that is, how many instructions before the actual utilization of the data should I make the prefetch call. I will be measuring the L1 cache hit rate with valgrind's cachegrind,... (3 Replies)
Discussion started by: Tavo
3 Replies

7. Shell Programming and Scripting

Timing out lynx request in a bash script

I have a Bash script where, in a loop, I access several urls. Sometimes, if an url is not available, lynx hangs, and the script does not continue. How can I time out the lynx request when it takes more than, 10 Seconds, but continue with the other jobs... For some reason lynx does not care... (1 Reply)
Discussion started by: lowmaster
1 Replies

8. Shell Programming and Scripting

Challenging task : script for mailing process completion timing report to users.

Hi all, This is my first post. I am new to unix scripting. My requirement is as follows : We are using a financial backoffice application. Now at the end of day we have send users a status report stating all timings of EOD processes for all countries. I need timings for following... (0 Replies)
Discussion started by: ammbhhar
0 Replies

9. Shell Programming and Scripting

Timing the shell script

I have two shell scripts, one written with xargs for parallel processing (p1) and the other written in old school way (p3) . when I execute them, i get the below values. $ time ./p1 real 0m25.36s user 0m0.32s sys 0m0.80s $ time ./p3 real 0m23.25s user 0m6.20s sys ... (4 Replies)
Discussion started by: luhah
4 Replies

10. Programming

Byte swap timing

I have noticed the difference in byte swap timing between two Ubuntu systems. The bswap_32 used to work just fine on the old system, but on the new one it lags behind home-grown swap. My code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <byteswap.h> #include... (4 Replies)
Discussion started by: migurus
4 Replies
sh(1)							      General Commands Manual							     sh(1)

NAME
sh - Shell, the standard command language interpreter DESCRIPTION
[Tru64 UNIX] Tru64 UNIX provides two command interpreters with the name sh. The XCU5.0 and POSIX.2 compliant command interpreter sh is available in the file /usr/bin/posix/sh and is described in the sh(1p) reference page. The Bourne shell, historically known as sh, is available in the file /usr/bin/sh and is described in the sh(1b) reference page. [Tru64 UNIX] Your initial, or login, shell is determined by your entry in the file /etc/passwd. This file can be changed only by your sys- tem administrator. You must use whatever procedures are in place at your location to have this entry changed. [Tru64 UNIX] If available on your system, you may use the passwd -s or the chsh commands to change your login shell. Note This option is not available if your site manages passwords through the Network Information Service (NIS) facility. Check with your system administrator. [Tru64 UNIX] Subsequent shells spawned from the initial shell depend on the value in the environment variable BIN_SH. If this variable is set to xpg4, the POSIX shell is started. If this variable is set to svr4, an SVR4 compliant version of the shell is started. If this vari- able is unset, the Bourne shell is started. If this variable is set to any other value, an error is reported and the results are unpre- dictable. See the EXAMPLES section for information on setting this variable. NOTES
[Tru64 UNIX] With Tru64 UNIX Version 4.0 the Korn shell, /usr/bin/ksh is the same as the POSIX shell /usr/bin/posix/sh. RESTRICTIONS
[Tru64 UNIX] The file /etc/shells must include entries for both the POSIX shell /usr/bin/posix/sh and the Bourne shell, /usr/bin/sh. If this file is incorrect, see your system administrator. EXAMPLES
Using the Bourne, Korn, or POSIX shell, to set the variable BIN_SH to use the POSIX/ XCU5.0compliant shell, enter: BIN_SH=xpg4 export BIN_SH Using the Bourne, Korn, or POSIX shell, to set the variable BIN_SH to use the SVR4 compliant shell, enter: BIN_SH=svr4 export BIN_SH Using the Bourne, Korn, or POSIX shell, to unset the variable BIN_SH, enter: unset BIN_SH Using the C/ shell, to set the variable BIN_SH to use the POSIX/XCU5.0 compliant shell, enter: setenv BIN_SH xpg4 Using the C/ shell, to set the variable BIN_SH to use the SVR4 compliant shell, enter: setenv BIN_SH svr4 Using the C/ shell, to unset the variable BIN_SH, enter: unsetenv BIN_SH FILES
User profile. Contains user information, including the login shell name. Contains the names of available and permitted shells. SEE ALSO
Commands: csh(1), ksh(1), Bourne shell sh(1b), POSIX shell sh(1p), passwd(1) Files: passwd(4), shells(4) Standards: standards(5) sh(1)
All times are GMT -4. The time now is 03:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy