Project.pm: do not unlink nonexistent file
[girocco.git] / toolbox / kill-stale-daemons.pl
blobe79f91c6e61529b8007eae241cda1e56b754fc14
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
5 use lib "__BASEDIR__";
7 use Girocco::Config;
8 use Proc::ProcessTable;
10 use Data::Dumper;
12 my $week_ago = time-60*60*24*7;
13 my $t = new Proc::ProcessTable;
15 my $reporoot = $Girocco::Config::reporoot;
16 foreach my $p ( @{$t->table} ) {
17 if ($p->start() < $week_ago &&
18 ($p->cmndline() =~ /git[- ]daemon --inetd --verbose --export-all --enable=upload-archive --base-path=\Q$reporoot\E/o ||
19 $p->cmndline() =~ /git[- ]upload-pack --strict --timeout=0 \./ ||
20 $p->cmndline() =~ /peek_packet/)) {
21 print Dumper $p if $ENV{'PERL_DEBUG'};
22 kill 9, $p->pid;