-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug.pl
More file actions
executable file
·31 lines (26 loc) · 887 Bytes
/
debug.pl
File metadata and controls
executable file
·31 lines (26 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl
use strict; use warnings;
use feature 'say';
use FindBin;
# verify MHFS is not running
my $pidsres = `pgrep -d ' ' 'perl'`;
my @pids = split( ' ', $pidsres);
$pidsres = `pgrep -d ' ' -f 'server.pl'`;
my @opids = split( ' ', $pidsres);
foreach my $perls (@pids) {
foreach my $spls (@opids) {
if($perls eq $spls) {
my $pwdxres = `pwdx $spls`;
$pwdxres =~ /(\/.+)$/;
if($1 eq $FindBin::Bin) {
say "server.pl $spls running, attempting to kill it";
system('kill' , '-9', $perls) == 0 or die("Failed to kill pid " . $perls);
}
}
}
}
chdir($FindBin::Bin) or die("Failed to change to script location");
# build mhfs
system('make') == 0 or die("Failed to build MHFS");
# run the server
exec('perl', 'runintree.pl', '--flush', '--debug', @ARGV);