Merge branch 'master' of git.rot13.org:/git/cloudstore
authorDobrica Pavlinusic <dpavlin@smtp.calyx.hr>
Tue, 23 Aug 2011 23:35:03 +0000 (01:35 +0200)
committerDobrica Pavlinusic <dpavlin@smtp.calyx.hr>
Tue, 23 Aug 2011 23:35:03 +0000 (01:35 +0200)
1  2 
rsync-piper.pl

diff --combined rsync-piper.pl
@@@ -120,12 -120,13 +120,13 @@@ if ( -e $pid_file ) 
        my $pid = read_file $pid_file;
        chomp($pid);
        if ( kill 0, $pid ) {
-               warn "found rsync pid $pid";
+               warn "found rsync pid $pid\n";
                kill 2, $pid;
                while ( -e $pid_file ) {
-                       warn "waiting for rsync to die...";
+                       warn "waiting for rsync to die...\n";
                        sleep 1;
                }
+               kill 0, $pid && die "can't kill it!";
        } else {
                unlink $pid_file;
        }
@@@ -147,11 -148,9 +148,11 @@@ if ( ! -e $pid_file ) 
        }
  }
  
 +=for gearman
  use Gearman::Client;
  my $gearman = Gearman::Client->new;
  $gearman->job_servers('127.0.0.1:4730');
 +=cut
  
  while(1) {
        warn "# reading log output from $log_fifo\n";
  
                        my $json = CloudStore::JSON::rsync_transfer \%data;
  
 +=for gearman
                        $gearman->dispatch_background( 'rsync_transfer' => $json );
 +=cut
  
                }
        }