forked from buzzhub/lsyupdate
1
This commit is contained in:
parent
cee2535766
commit
dd455def17
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# FRPC 配置目录和文件路径
|
# FRPC 配置目录和文件路径
|
||||||
|
FLAG_FILE="/tmp/lsyfrpc_check_config_running"
|
||||||
FRPC_FILE="/data/lsyfrpc/frpc"
|
FRPC_FILE="/data/lsyfrpc/frpc"
|
||||||
FRPC_DIR="/data/lsyfrpc"
|
FRPC_DIR="/data/lsyfrpc"
|
||||||
CONFIG_FILE="$FRPC_DIR/frpc.ini"
|
CONFIG_FILE="$FRPC_DIR/frpc.ini"
|
||||||
@ -55,7 +56,19 @@ function check_config() {
|
|||||||
# 比较配置文件中的 MAC 地址和端口是否与云端匹配
|
# 比较配置文件中的 MAC 地址和端口是否与云端匹配
|
||||||
if [ "$current_mac_address" != "$cloud_mac_address" ] || [ "$current_port" != "$cloud_port" ]; then
|
if [ "$current_mac_address" != "$cloud_mac_address" ] || [ "$current_port" != "$cloud_port" ]; then
|
||||||
echo "[INFO] Configuration mismatch detected. Re-running install.sh..."
|
echo "[INFO] Configuration mismatch detected. Re-running install.sh..."
|
||||||
sudo /bin/bash $FRPC_DIR/frp_install.sh
|
# sudo /bin/bash $FRPC_DIR/frp_install.sh
|
||||||
|
cat > "$FRPC_DIR/frpc.ini" <<EOF
|
||||||
|
[common]
|
||||||
|
server_addr = box.jxm.cool
|
||||||
|
server_port = 8000
|
||||||
|
token = 92098d16-1961-4bda-902b-e43e3d41d5a9
|
||||||
|
|
||||||
|
[$cloud_mac_address]
|
||||||
|
type = tcp
|
||||||
|
local_ip = 127.0.0.1
|
||||||
|
local_port = 22
|
||||||
|
remote_port = $cloud_port
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
echo "[INFO] Configuration is up to date."
|
echo "[INFO] Configuration is up to date."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -46,8 +46,8 @@ Type=simple
|
|||||||
# ExecStartPre=/bin/mkdir -p "$FRPC_DIR/var/"
|
# ExecStartPre=/bin/mkdir -p "$FRPC_DIR/var/"
|
||||||
# ExecStartPre=/bin/bash "$FRPC_DIR/check_config.sh"
|
# ExecStartPre=/bin/bash "$FRPC_DIR/check_config.sh"
|
||||||
ExecStart="$FRPC_FILE" -c "$FRPC_DIR/frpc.ini"
|
ExecStart="$FRPC_FILE" -c "$FRPC_DIR/frpc.ini"
|
||||||
ExecStartPost=/bin/bash "$FRPC_DIR/check_config.sh"
|
ExecStartPost=/bin/bash -c "$FRPC_DIR/check_config.sh &"
|
||||||
PIDFile="$FRPC_DIR/frpc.pid"
|
# PIDFile="$FRPC_DIR/frpc.pid"
|
||||||
|
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user