From 63dc4d38a030ad2fce480af90bc8bbfff0010119 Mon Sep 17 00:00:00 2001 From: Wang Sen Di Date: Wed, 17 Dec 2025 11:31:50 +0800 Subject: [PATCH] - --- boot/start.sh | 2 +- deploy/release/t20251217/start.sh | 66 +++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 deploy/release/t20251217/start.sh diff --git a/boot/start.sh b/boot/start.sh index 8612174..46a3ba7 100755 --- a/boot/start.sh +++ b/boot/start.sh @@ -7,7 +7,7 @@ __main() { tmux new-session -ds tmux # 主进程,避免 pkill 误杀 bash /apps/gitrce/boot/conflict.sh >/dev/null 2>&1 - bash /apps/gitrce/deploy/release/default/start.sh >/dev/null 2>&1 + # bash /apps/gitrce/deploy/release/default/start.sh >/dev/null 2>&1 bash /apps/gitrce/netflow/iptables.sh >/dev/null 2>&1 } diff --git a/deploy/release/t20251217/start.sh b/deploy/release/t20251217/start.sh new file mode 100644 index 0000000..4e33dc3 --- /dev/null +++ b/deploy/release/t20251217/start.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# 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 + +__kill_process() { + pkill -f "lotso run" 2>/dev/null +} + +__download_lotso() { + _tmp_path="${_lotso_path}.tmp" + + curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso -o "$_tmp_path" || return + + chmod +x "$_tmp_path" + mv "$_tmp_path" "$_lotso_path" +} + +__check_md5() { + _remote_md5=$(curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso.md5 || echo "") + [[ -z "$_remote_md5" ]] && return + + if [[ ! -f "$_lotso_path" ]]; then + __download_lotso + return + fi + + _local_md5=$(md5sum "$_lotso_path" | cut -d' ' -f1) + + if [[ "$_remote_md5" != "$_local_md5" ]]; then + __download_lotso + __kill_process + fi +} + +__check_process() { + if ! pgrep -f "lotso run" >/dev/null 2>&1; 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 + fi +} + +__main() { + { + _strong_path="/storage/al-wx" + _lotso_path="$_strong_path/lotso" + + mkdir -p "$_strong_path" 2>/dev/null + echo "$(date '+%Y-%m-%d %H:%M:%S') start.sh" + __check_md5 + __check_process + } +} + +__main + +__help() { + cat >/dev/null <<-'EOF' + + + EOF +}