In message <A103903D0DE0D1119EE800805FD69AC402D08B04@XCGNY005>, "Allen, John L.
" writes:

> I'm new to rsync, so be gentle... I have need to use rsync, but want 
> to have it operate only off-hours when the network is lightly loaded. 
> I did not see any option for making rsync obey an "operating time 
> window" so that it would basically cease copying data if the time-of-day 
> falls outside a specified window.  I thus thought it might be a good idea
> to have a --operating-window option where you could specify an 
> allowed time of operation by indicating two endpoints, perhaps like this
> 
>       --operating-window 22:00-05:00
> 
> where the times are given in HH:MM 24-hour military time.  
> You could obviously extend this to allow for multiple disjoint windows,
> but I don't think there's much point.


I've done something like this using a shell script.  
Essentially the code goes like this:

   if in_operating_window ; then
        echo kill -HUP $$ | at $end_operating_window_time
        exec rsync "$@"
   else 
        echo $0 "$@" | at $start_operating_window_time
   fi

as you can see, the script uses at(1) to resubmit itself if it's not
running during the operating window, otherwise it sets up an at job
that will send the script a SIGHUP (causing the running rsync to exit)
at the end of the operating window.


-- Alberto


****************************************************************************
Alberto Accomazzi                          mailto:[EMAIL PROTECTED]
NASA Astrophysics Data System                      http://adsabs.harvard.edu
Harvard-Smithsonian Center for Astrophysics        http://cfawww.harvard.edu
60 Garden Street, MS 83, Cambridge, MA 02138 USA   
****************************************************************************

Reply via email to