| [reply] |
Special variable $^T gives the epoch time when the application started executing. time - $^T gives the number of seconds the application has been running.
True laziness is hard work
| [reply] |
watchdog -t 7200 script
Update: Fixed fork error check.
Update: Added command line options and moved code into its own (CUFP) node.
| [reply] [d/l] [select] |
| [reply] [d/l] |
And of course exit is the function to call to end the program cleanly once its time has come.
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
| [reply] [d/l] |
You don't identify the type of script - if it were sh/ksh i.e. a half decent shell :-), I'd let the OS do the work ... something like
at now + 2 hours "kill $$"
A user level that continues to overstate my experience :-))
| [reply] [d/l] [select] |
use localtime() like
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
then compare the $hour with ur system time
then in subrouten write this module
sub kill
{
$pid=getpgrp(); ######## To get the Process ID
system("kill $pid");
}
| [reply] |