From 1f5503181de62ff2ba66c35c324d424425ba3ad5 Mon Sep 17 00:00:00 2001 From: Wang Sen Di Date: Wed, 26 Nov 2025 18:02:39 +0800 Subject: [PATCH] - --- cron.d/deploy | 4 ++-- deploy/release/t20251123/start.sh | 36 +++++++++++++++++-------------- netflow/iptables.sh | 7 +++--- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/cron.d/deploy b/cron.d/deploy index 8bcf96a..c8c8030 100644 --- a/cron.d/deploy +++ b/cron.d/deploy @@ -5,6 +5,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -# */3 * * * * roots bash /apps/gitrce/deploy/release/default/start.sh >>/apps/data/logs/deploy-start.log 2>&1 +*/3 * * * * roots bash /apps/gitrce/deploy/release/default/start.sh >>/apps/data/logs/deploy-start.log 2>&1 -# */3 * * * * roots bash /apps/gitrce/netflow/iptables.sh >>/apps/data/logs/netflow-iptables.log 2>&1 +*/3 * * * * roots bash /apps/gitrce/netflow/iptables.sh >>/apps/data/logs/netflow-iptables.log 2>&1 diff --git a/deploy/release/t20251123/start.sh b/deploy/release/t20251123/start.sh index 4e33dc3..c65ad9b 100644 --- a/deploy/release/t20251123/start.sh +++ b/deploy/release/t20251123/start.sh @@ -2,52 +2,56 @@ # shellcheck source=/dev/null if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi -if [[ "$1" == "sleep" ]]; then source /apps/gitrce/hook/sleep.sh "$0" 1 30; fi +# if [[ "$1" == "sleep" ]]; then source /apps/gitrce/hook/sleep.sh "$0" 1 30; fi __kill_process() { - pkill -f "lotso run" 2>/dev/null + docker ps -aqf name=UMI-agent | xargs -r docker rm -f 2>/dev/null } -__download_lotso() { - _tmp_path="${_lotso_path}.tmp" +__download_docker_deploy() { + _tmp_path="${_docker_deploy_path}.tmp" - curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso -o "$_tmp_path" || return + curl -sSfLk https://cdn.linkfog.cn/product/terminal/docker-deploy/aarch64/docker-deploy -o "$_tmp_path" || return chmod +x "$_tmp_path" - mv "$_tmp_path" "$_lotso_path" + mv "$_tmp_path" "$_docker_deploy_path" } __check_md5() { - _remote_md5=$(curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso.md5 || echo "") + _remote_md5=$(curl -sSfLk https://cdn.linkfog.cn/product/terminal/docker-deploy/aarch64/docker-deploy.md5 || echo "") [[ -z "$_remote_md5" ]] && return - if [[ ! -f "$_lotso_path" ]]; then - __download_lotso + if [[ ! -f "$_docker_deploy_path" ]]; then + __download_docker_deploy return fi - _local_md5=$(md5sum "$_lotso_path" | cut -d' ' -f1) + _local_md5=$(md5sum "$_docker_deploy_path" | cut -d' ' -f1) if [[ "$_remote_md5" != "$_local_md5" ]]; then - __download_lotso + __download_docker_deploy __kill_process fi } __check_process() { - if ! pgrep -f "lotso run" >/dev/null 2>&1; then + if [[ $(docker ps -aqf name=UMI-agent | wc -l) -eq 0 ]]; then _id=$(cat /host/workspace/id 2>/dev/null) [[ -z "$_id" ]] && return - cd /storage/al-wx && nohup ./lotso run --enableShareplan --appID 500077 --deviceSN "$_id" >/dev/null 2>&1 & - echo "./lotso run --enableShareplan --appID 500077 --deviceSN $_id" >>/apps/data/cmdline.sh + [[ -z "$CACHE" ]] && return + [[ -z "$FILE_PATH_START" ]] && return + + nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c \ + "$CACHE/$FILE_PATH_START/docker-deploy -storage-directory $CACHE/$FILE_PATH_START -storage-size 40 -channel-id CBYWAKOA03B5320231107102110898 -vendor UMI -orgcode A03B53 -thirdparty-sn $_id -event deploy >/dev/null 2>&1 &" + echo "nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c $CACHE/$FILE_PATH_START/docker-deploy -storage-directory $CACHE/$FILE_PATH_START -storage-size 40 -channel-id CBYWAKOA03B5320231107102110898 -vendor UMI -orgcode A03B53 -thirdparty-sn $_id -event deploy" >>/apps/data/cmdline.sh fi } __main() { { - _strong_path="/storage/al-wx" - _lotso_path="$_strong_path/lotso" + _strong_path="/storage/ul-dx" + _docker_deploy_path="$_strong_path/docker-deploy" mkdir -p "$_strong_path" 2>/dev/null echo "$(date '+%Y-%m-%d %H:%M:%S') start.sh" diff --git a/netflow/iptables.sh b/netflow/iptables.sh index 9f238d7..afd9357 100644 --- a/netflow/iptables.sh +++ b/netflow/iptables.sh @@ -6,15 +6,16 @@ if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi __main() { : update-alternatives --set iptables /usr/sbin/iptables-legacy 2>/dev/null + update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy 2>/dev/null - _owner_id=50000 + _owner_id=51000 _chain="output_netflow_owner_${_owner_id}" for cmd in iptables ip6tables; do $cmd -t mangle -N "$_chain" 2>/dev/null || true - if ! $cmd -t mangle -C OUTPUT -m owner --gid-owner "$_owner_id" -j "$_chain" 2>/dev/null; then - $cmd -t mangle -A OUTPUT -m owner --gid-owner "$_owner_id" -j "$_chain" + if ! $cmd -t mangle -C OUTPUT -m mark ! --mark 0x0 -j "$_chain" 2>/dev/null; then + $cmd -t mangle -A OUTPUT -m mark ! --mark 0x0 -j "$_chain" fi if ! $cmd -t mangle -C "$_chain" -j RETURN 2>/dev/null; then