[PATCH] time limit

Tim Conway conway at us.ibm.com
Tue Apr 20 14:56:49 GMT 2004


Ok, now that's just plain ugly.
Here, I just wrote you this...
cnwt99 at 78KZAZ2
/home/cnwt99>cat runfor 
#!/usr/bin/perl

#runfor   usage:runfor seconds commandline

#need it to get the correct value for WNOHANG
use POSIX ":sys_wait_h";

#pull the params
($runtime, @commandline) = @ARGV ;
#assemble the commandline
$commandline = join(' ', @commandline) ;

#save the pid to kill
if( $kidpid = fork() ){
#and let it run
sleep($runtime);
#see if it's still there.  the "0" looks for children within this
#process group, in case it's completed and the pid's been re-used...
#it happens, though it might be held as a zombie for us... can't
#count on it, though. - if response<0, it's still running
unless(0 < waitpid(0, WNOHANG)){
#kill it
kill(15, $kidpid) ;
}
exit(0);
}else{
#fork and give it our slot
exec( $commandline );
}
cnwt99 at 78KZAZ2
/home/cnwt99>


Tim Conway
Unix System Administration
Contractor - IBM Global Services
desk:3032734776
conway at us.ibm.com




Jan-Benedict Glaw <jbglaw at lug-owl.de> 
Sent by: rsync-bounces+conway=us.ibm.com at lists.samba.org
04/20/2004 06:30 AM

To
rsync at lists.samba.org
cc

Subject
Re: [PATCH] time limit






On Mon, 2004-04-19 16:28:08 -0400, John Taylor <john at fcs.uga.edu>
wrote in message <20040419202808.GA23665 at spock.fcs.uga.edu>:

> I have written a patch for rsync-2.6.1pre-2 which adds a --time-limit=T
> option.  When this option is used rsync will stop after T minutes
> and exit.  I think this option is useful when rsyncing a large amount

Okay, nice thing. What about

$ echo "killall rsync" | at midnight

Of couse, you can make that a bit more flexible if you've got several
concurrent rsync running (by using their PID and checking it before
killing it to actually be a rsync instance)...

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw at lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen 
Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im 
Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | 
TCPA));
-- 
To unsubscribe or change options: 
http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/octet-stream
Size: 195 bytes
Desc: not available
Url : http://lists.samba.org/archive/rsync/attachments/20040420/433aafc0/signature.obj


More information about the rsync mailing list