die if process can't be killed
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 23 Aug 2011 23:31:05 +0000 (23:31 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 23 Aug 2011 23:31:05 +0000 (23:31 +0000)
rsync-piper.pl

index 12574eb..5751e96 100755 (executable)
@@ -120,12 +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;
        }