The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To reduce execution time Sreejith_VK Shell Programming and Scripting 4 05-13-2008 02:49 AM
Estimated execution time Sreejith_VK Shell Programming and Scripting 4 04-16-2008 09:23 AM
script execution time calculation johnsonbryce Shell Programming and Scripting 9 02-25-2006 01:33 AM
last execution time cubs0729 UNIX for Dummies Questions & Answers 1 01-20-2006 08:45 PM
execution time ramki_rk High Level Programming 2 08-27-2003 09:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2008
VGR VGR is offline
Registered User
  
 

Join Date: Mar 2008
Location: kolkata
Posts: 34
Talking specifying an execution time

Hi all,
do ny o u'll know how to set a particular execution time for a program???
for eg.:
--> during the execution of a file, i call a certain other function.
--> while calling this function, my comp hangs.

now is there ny way in which i can go to the nxt line of code by aborting the call within a specified period of time??

thanx

  #2 (permalink)  
Old 03-18-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
Quote:
Originally Posted by VGR View Post
Hi all,
do ny o u'll know how to set a particular execution time for a program???
Do not write short words that do not exist in English.

Check the at command to run a command at a specified time
  #3 (permalink)  
Old 03-18-2008
era
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
You mean set a timeout, and kill the process if it takes too long?

The ALARM facility can be used, but there is no completely standard user-space interface to that. Postfix (I think) comes with a tiny utility called "timeout", or you can write your own simple Perl script or C program if you understand the concept of signals. (Stevens' book probably has an example program.)
  #4 (permalink)  
Old 03-18-2008
VGR VGR is offline
Registered User
  
 

Join Date: Mar 2008
Location: kolkata
Posts: 34
well signals as in ...

kill -9 <process di> shld terminate the process...
but i didn't quiet understand the timeout part .....

aren't there ny shell commands i can embedd a paticular line of code in??
something like try - catch in java????
  #5 (permalink)  
Old 03-18-2008
VGR VGR is offline
Registered User
  
 

Join Date: Mar 2008
Location: kolkata
Posts: 34
with the only difference being that i get to control the amt o time it takes, taking the real time execution as a parameter.
  #6 (permalink)  
Old 03-18-2008
era
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
The ALARM facility sets a signal (SIGALRM) to be delivered at a particular time in the future.

Like I said, the "timeout" program (in probably a myriad different implementations) exists, but is not standard.

Code:
 debian$ timeout --help
usage: timeout [-signal] time command...

debian$ apt-cache show timeout
Package: timeout
Priority: optional
Section: admin
Installed-Size: 52
Maintainer: Andrew Stribblehill <ads@debian.org>
Architecture: i386
Source: tct
Version: 1.11-6.3
Replaces: tct (<= 1.07-2), netatalk (<< 1.5pre6-7)
Depends: libc6 (>= 2.3.6-6)
Conflicts: tct (<= 1.07-2), netatalk (<< 1.5pre6-7)
Filename: pool/main/t/tct/timeout_1.11-6.3_i386.deb
Size: 6428
MD5sum: b2e00eb4be5346a37da976ac760f9946
SHA1: 7f75f33432efc101d4c160fd0d1a4bc6555be2cd
SHA256: 518e6c460f1a37e76153750a90ffe85111bb558dbbc2ae96a617ca4f3ff106c1
Description: Run a command with a time limit.
 timeout executes a command and imposes an elapsed time limit. When the
 time limit is reached, timeout sends a predefined signal to the target
 process.
Tag: interface::commandline, role::program, scope::utility, use::timekeeping, works-with::software:running
  #7 (permalink)  
Old 03-19-2008
VGR VGR is offline
Registered User
  
 

Join Date: Mar 2008
Location: kolkata
Posts: 34
@era...
thanks man.... but im using an AIX server which, doesn't have a timeout function
guess i'll have to write some code in c/c++/perl to call this file seprately....
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0