替换云主机镜像,更换frpc目录

master
youys 2 years ago
parent fff1bbda01
commit 2a9c0c0ace

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

@ -7,7 +7,7 @@ server:
jcloud: jcloud:
username: educoder01 username: educoder01
password: Educoder123 password: Educoder123
imageId: 6d3b7f00-0c33-4bad-9a74-ca7d8d7e7b39 imageId: 2cd74f05-2a57-4a69-bcd2-f7939de7ddbc
frpc: frpc:
host: 39.104.50.181 host: 39.104.50.181
template: "[common]\nserver_addr = {param1}\nserver_port = 7000\n[ssh{param2}]\ntype = tcp\nlocal_ip = 127.0.0.1\nlocal_port = 22\nremote_port = {param2}" template: "[common]\nserver_addr = {param1}\nserver_port = 7000\n[ssh{param2}]\ntype = tcp\nlocal_ip = 127.0.0.1\nlocal_port = 22\nremote_port = {param2}"

Loading…
Cancel
Save