kill rsync with INT if allready running
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 22 Jul 2011 13:15:02 +0000 (13:15 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 22 Jul 2011 13:15:02 +0000 (13:15 +0000)
rsync-piper.pl

index fa9a4fb..bbb51e5 100755 (executable)
@@ -120,6 +120,11 @@ if ( -e $pid_file ) {
        chomp($pid);
        if ( kill 0, $pid ) {
                warn "found rsync pid $pid";
+               kill 2, $pid;
+               while ( -e $pid_file ) {
+                       warn "waiting for rsync to die...";
+                       sleep 1;
+               }
        } else {
                unlink $pid_file;
        }