@@ -4910,10 +4910,25 @@ private void StartSetUpMtg(ConnectionInfo connectionInfo)
4910
4910
MainWindowsShowInfo ( currentStatus ) ;
4911
4911
//读取生成的代理参数
4912
4912
sshShellCommand = @"cat /usr/local/etc/mtg_info.json" ;
4913
- currentShellCommandResult = client . RunCommand ( sshShellCommand ) . Result ;
4914
-
4915
- //结果保存在ReceiveConfigurationParameters[9]中
4913
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4916
4914
ReceiveConfigurationParameters [ 9 ] = currentShellCommandResult ;
4915
+ if ( currentShellCommandResult . Contains ( @"No such file or directory" ) )
4916
+ {
4917
+ sshShellCommand = @"systemctl stop mtg" ;
4918
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4919
+ sshShellCommand = @"cat /usr/local/etc/mtg.sh" ;
4920
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4921
+ sshShellCommand = currentShellCommandResult ;
4922
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4923
+ sshShellCommand = @"cat /usr/local/etc/mtg_info.json" ;
4924
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4925
+ ReceiveConfigurationParameters [ 9 ] = currentShellCommandResult ;
4926
+ sshShellCommand = @"pkill mtg" ;
4927
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4928
+ sshShellCommand = @"systemctl restart mtg" ;
4929
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
4930
+ }
4931
+
4917
4932
client . Disconnect ( ) ; //断开服务器ssh连接
4918
4933
4919
4934
//Thread.Sleep(1000);
@@ -5924,6 +5939,9 @@ private void StartRemoveProxySoft(ConnectionInfo connectionInfo)
5924
5939
sshShellCommand = @"rm -rf /usr/local/etc/mtg_info.json" ;
5925
5940
currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
5926
5941
5942
+ sshShellCommand = @"rm -rf /usr/local/etc/mtg.sh" ;
5943
+ currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
5944
+
5927
5945
sshShellCommand = @"find / -name mtg" ;
5928
5946
currentShellCommandResult = MainWindowsShowCmd ( client , sshShellCommand ) ;
5929
5947
0 commit comments