File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ public function __construct()
38
38
public function handle ()
39
39
{
40
40
$ tunnel = new CreateTunnel ();
41
- return 0 ;
41
+ $ tunnel ->destoryTunnel ();
42
+
43
+ \Artisan::call ('tunneler:activate ' );
42
44
}
43
45
}
Original file line number Diff line number Diff line change @@ -58,13 +58,13 @@ public function handle(): int
58
58
}
59
59
60
60
$ this ->createTunnel ();
61
-
61
+
62
62
$ tries = config ('tunneler.tries ' );
63
63
for ($ i = 0 ; $ i < $ tries ; $ i ++) {
64
64
if ($ this ->verifyTunnel ()) {
65
65
return 2 ;
66
66
}
67
-
67
+
68
68
// Wait a bit until next iteration
69
69
usleep (config ('tunneler.wait ' ));
70
70
}
@@ -101,6 +101,14 @@ protected function verifyTunnel()
101
101
return $ this ->runCommand ($ this ->ncCommand );
102
102
}
103
103
104
+ /*
105
+ * Use pkill to kill the SSH tunnel
106
+ */
107
+
108
+ public function destoryTunnel (){
109
+ return $ this ->runCommand ('pkill -f " ' .$ this ->sshCommand .'" ' );
110
+ }
111
+
104
112
/**
105
113
* Runs a command and converts the exit code to a boolean
106
114
* @param $command
You can’t perform that action at this time.
0 commit comments