Ok, now that's just plain ugly.
Here, I just wrote you this...
[EMAIL PROTECTED]
/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 );
}
[EMAIL PROTECTED]
/home/cnwt99>


Tim Conway
Unix System Administration
Contractor - IBM Global Services
desk:3032734776
[EMAIL PROTECTED]




Jan-Benedict Glaw <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
04/20/2004 06:30 AM

To
[EMAIL PROTECTED]
cc

Subject
Re: [PATCH] time limit






On Mon, 2004-04-19 16:28:08 -0400, John Taylor <[EMAIL PROTECTED]>
wrote in message <[EMAIL PROTECTED]>:

> 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       [EMAIL PROTECTED]    . +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

Attachment: signature.asc
Description: Binary data

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to