![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 ![]() |
|
||||
|
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.) |
|
||||
|
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???? |
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|