forked from buzzhub/lsyupdate
1
This commit is contained in:
parent
cee2535766
commit
dd455def17
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# FRPC 配置目录和文件路径
|
||||
FLAG_FILE="/tmp/lsyfrpc_check_config_running"
|
||||
FRPC_FILE="/data/lsyfrpc/frpc"
|
||||
FRPC_DIR="/data/lsyfrpc"
|
||||
CONFIG_FILE="$FRPC_DIR/frpc.ini"
|
||||
@ -55,7 +56,19 @@ function check_config() {
|
||||
# 比较配置文件中的 MAC 地址和端口是否与云端匹配
|
||||
if [ "$current_mac_address" != "$cloud_mac_address" ] || [ "$current_port" != "$cloud_port" ]; then
|
||||
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
|
||||
echo "[INFO] Configuration is up to date."
|
||||
fi
|
||||
|
||||
@ -46,8 +46,8 @@ Type=simple
|
||||
# ExecStartPre=/bin/mkdir -p "$FRPC_DIR/var/"
|
||||
# ExecStartPre=/bin/bash "$FRPC_DIR/check_config.sh"
|
||||
ExecStart="$FRPC_FILE" -c "$FRPC_DIR/frpc.ini"
|
||||
ExecStartPost=/bin/bash "$FRPC_DIR/check_config.sh"
|
||||
PIDFile="$FRPC_DIR/frpc.pid"
|
||||
ExecStartPost=/bin/bash -c "$FRPC_DIR/check_config.sh &"
|
||||
# PIDFile="$FRPC_DIR/frpc.pid"
|
||||
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
Loading…
Reference in New Issue
Block a user