|
|
|
@ -10,7 +10,6 @@ import net.educoder.util.JCloudUtil;
|
|
|
|
|
import net.educoder.util.ShellUtil;
|
|
|
|
|
import net.educoder.util.SleepUtil;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.ThreadUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
@ -139,6 +138,7 @@ public class CloudHostService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 内网穿透
|
|
|
|
|
* /opt/01/02/02 frpc目录
|
|
|
|
|
*
|
|
|
|
|
* @param port
|
|
|
|
|
* @param username
|
|
|
|
@ -153,7 +153,7 @@ public class CloudHostService {
|
|
|
|
|
// 通过浮动ip+port 连接ssh执行脚本
|
|
|
|
|
String command = StringUtils.join("sshpass -p ", password, " ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ",
|
|
|
|
|
username, "@", floatingIp, " \'",
|
|
|
|
|
"cd /root/frp_0.44.0_linux_amd64; sudo echo -e \"", template, "\" > frpc.ini ; cat frpc.ini; nohup ./frpc >& cataline.log 2>&1 &", "\'");
|
|
|
|
|
"cd /opt/01/02/02; sudo echo -e \"", template, "\" > frpc.ini ; cat frpc.ini; nohup ./frpc >& cataline.log 2>&1 &", "\'");
|
|
|
|
|
String uuid = RandomUtil.randomString(16);
|
|
|
|
|
log.info("id{},配置内网穿透命令:{}", uuid, command);
|
|
|
|
|
String execResult = ShellUtil.execute(command);
|
|
|
|
|