|
@ -192,7 +192,7 @@ public class CellularNetworkService : ICellularNetworkService |
|
|
{ |
|
|
{ |
|
|
if (command.CanBeKilled) |
|
|
if (command.CanBeKilled) |
|
|
{ |
|
|
{ |
|
|
await KillProcessAsync(command.Template, command.Timeout); |
|
|
return await KillProcessAsync(command.Template, command.Timeout); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var result = await _commandExecutor.ExecuteCommandAsync(command.Template, new CancellationTokenSource(),command.Timeout); |
|
|
var result = await _commandExecutor.ExecuteCommandAsync(command.Template, new CancellationTokenSource(),command.Timeout); |
|
@ -205,11 +205,12 @@ public class CellularNetworkService : ICellularNetworkService |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task KillProcessAsync(string template,int Timeout) |
|
|
private async Task<bool> KillProcessAsync(string template,int Timeout) |
|
|
{ |
|
|
{ |
|
|
string killCmd = $"ps -ef | grep {template} | grep -v grep | awk '{{print $2}}' | xargs kill -9"; |
|
|
string killCmd = $"ps -ef | grep {template} | grep -v grep | awk '{{print $2}}' | xargs kill -9"; |
|
|
await _commandExecutor.ExecuteCommandAsync(killCmd, new CancellationTokenSource()); |
|
|
var result = await _commandExecutor.ExecuteCommandAsync(killCmd, new CancellationTokenSource()); |
|
|
_logger.LogInformation("已终止进程: {Template}", template); |
|
|
_logger.LogInformation("已终止进程: {Template}", template); |
|
|
|
|
|
return result.IsSuccess; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task<bool> EnableNetworkInterfaceAsync(NetworkConfiguration networkConfig) |
|
|
private async Task<bool> EnableNetworkInterfaceAsync(NetworkConfiguration networkConfig) |
|
|