close only ssh session opened
This commit is contained in:
1 parent
fa89153a76
commit
d05c24b96a
1 file changed
+9
-5
@@ -11,6 +11,8 @@ use App\Utilities\Notice;
|
||||
|
||||
trait GrappingTournaments
|
||||
{
|
||||
protected int $pid;
|
||||
|
||||
/**
|
||||
* Summary of grap_tournaments_for_day
|
||||
*
|
||||
@@ -24,17 +26,17 @@ trait GrappingTournaments
|
||||
Notice::note('⚽ tournaments for day '.$day);
|
||||
Notice::note('⚽ close all vpn');
|
||||
}
|
||||
exec('killall ssh');
|
||||
// exec('killall ssh');
|
||||
|
||||
if ($this->debug) {
|
||||
Notice::note('⚽ open vpn');
|
||||
}
|
||||
exec('ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190');
|
||||
$this->pid = exec('ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 > /dev/null 2>&1 & echo $!');
|
||||
/**
|
||||
* SofaScoreDayTournament
|
||||
*/
|
||||
if ($this->debug) {
|
||||
Notice::note('get tournaments', 'g');
|
||||
Notice::note('get tournaments; pid: '.$this->pid, 'g');
|
||||
}
|
||||
|
||||
$this->day_tournaments = SofaScoreDayTournament::where('day', $day)->get();
|
||||
@@ -47,7 +49,8 @@ trait GrappingTournaments
|
||||
if ($this->debug) {
|
||||
Notice::note('⚽ close all vpn');
|
||||
}
|
||||
exec('killall ssh');
|
||||
// exec('killall ssh');
|
||||
exec("kill $this->pid");
|
||||
|
||||
return;
|
||||
} else {
|
||||
@@ -188,7 +191,8 @@ trait GrappingTournaments
|
||||
Notice::note('⚽ close all vpn');
|
||||
}
|
||||
|
||||
exec('killall ssh');
|
||||
// exec('killall ssh');
|
||||
exec("kill $this->pid");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user