shlib.sh: add mailref function
[girocco.git] / toolbox / kill-stale-daemons.pl
bloba5811d2010f5c17eb87af0c09716a8d4f2a59e7f
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;