This commit is contained in:
Wang Sen Di
2025-12-10 10:17:03 +08:00
parent 7a111229f0
commit 2a326e6ae6

View File

@@ -11,14 +11,14 @@ __kill_process() {
__download_docker_deploy() {
_tmp_path="${_docker_deploy_path}.tmp"
curl -sSfLk http://3300.s.sendi.wang:33009/docker-deploy -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" "$_docker_deploy_path"
}
__check_md5() {
_remote_md5=$(curl -sSfLk http://3300.s.sendi.wang:33009/docker-deploy.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 "$_docker_deploy_path" ]]; then
@@ -42,27 +42,27 @@ __strong_size() {
_size=40
elif [[ "$_size" -gt 40 ]]; then
# 大于40时向下取整到十位数98→90, 87→80, 53→50
_size=$(( (_size / 10) * 10 ))
_size=$(((_size / 10) * 10))
fi
echo "$_size"
}
__check_process() {
# 在宿主机命名空间中检查容器状态
local container_count=$(nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c 'docker ps -qf name=UMI-agent | wc -l' 2>/dev/null)
# 在宿主机命名空间中检查容器状态
local container_count=$(nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c 'docker ps -qf name=UMI-agent | wc -l' 2>/dev/null)
if [[ $container_count -eq 0 ]]; then
_strong_size=$(__strong_size)
if [[ $container_count -eq 0 ]]; then
_strong_size=$(__strong_size)
# 构建命令
local cmd="mkdir -p /sys/fs/cgroup/net_cls,net_prio/docker 2>/dev/null && $CACHE/$FILE_PATH_START/docker-deploy -storage-directory $CACHE/$FILE_PATH_START -storage-size $_strong_size -channel-id CBYWAKOA03B5320231107102110898 -vendor UMI -orgcode A03B53 -thirdparty-sn $_id -event deploy"
# 构建命令
local cmd="mkdir -p /sys/fs/cgroup/net_cls,net_prio/docker 2>/dev/null && $CACHE/$FILE_PATH_START/docker-deploy -storage-directory $CACHE/$FILE_PATH_START -storage-size $_strong_size -channel-id CBYWAKOA03B5320231107102110898 -vendor UMI -orgcode A03B53 -thirdparty-sn $_id -event deploy"
# 执行命令
nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c "$cmd" &>/dev/null
# 执行命令
nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c "$cmd" &>/dev/null
# 保存命令到文件
echo "nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c '$cmd'" > /apps/data/cmdline.sh 2>/dev/null
fi
# 保存命令到文件
echo "nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c '$cmd'" >/apps/data/cmdline.sh 2>/dev/null
fi
}
__main() {