On Fri, 2003-07-18 at 11:25, Bret Hughes wrote: > On Fri, 2003-07-18 at 08:43, Reuben D. Budiardja wrote: > > > On Thursday 17 July 2003 07:52 pm, Bret Hughes wrote: > > > How bout simply running rsync against the whole shebang but having > > > another cron job kill rysnc at the end of your time window? The next > > > > OK, those seems to be a more viable solution. Just kill the rsync after an > > hour, regardless how much data get transported. > > > > Will 'killall rsync' do it? Since of course I don't want to get up at 3 AM in > > the morning to kill rsync. If not, then a script needs to be written to get > > the pid and kill it, which I am not on how to do it just yet. > > Yeah probably but not too clean as it would kill anything else rsync > might be doing. How about wrapping the rsync call in a wrapper script > and writting the pid of the wrapper to a file: > > > [EMAIL PROTECTED] Workingdir]$ cat ~/bin/testrsync > #!/bin/bash > outfile="/tmp/rsync.out" > echo $$ > "/tmp/rsyncjob.pid" > echo "beginning rysnc.job at " `date` > "$outfile" > rsync -arvvze /usr/bin/ssh /home/bhughes/mydata compaq3:. >>"$outfile" > 2>&1 > > then you can have the kill job do something like : > > kill `cat /tmp/rsyncjob.pid` > > Those are backtics
Sorry for the previous non-snip After actually testing the script above I see that killing the wrapper did not kill the rsync job. is appears to work if you exec rsync instead of allowing it to fork by simply calling it. exec /usr/bin/rsync -arvvze /usr/bin/ssh remotehost:/remote/dir/path /local/mirror/dir >>"$outfile" > 2>&1 This might be double compressing if ssh is also using compression but I don't think it does by default. Bret -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list