Insar结合ISCE2,某一个文件进行并行-stackSentinel.py

stackSentinel.py

依次执行 run_01 到 run_15,记录各自的日志

并行执行 run_16 里的所有命令,仍然记录日志

不知道对不对,测试的时间有点长就给停了

bash 复制代码
#!/bin/bash

# ✅ 适用于 WSL/Linux
runfiles_path="/mnt/e/insar_order_test/Stacks/run_files"
log_dir="/mnt/e/insar_order_test/logs"

# 创建日志目录(如果不存在)
mkdir -p "$log_dir"

# 依次执行 run_01 到 run_15,并记录日志
for file in $(ls $runfiles_path/run_??_* 2>/dev/null | grep -v "run_16" | sort); do
    log_file="$log_dir/$(basename "$file").log"
    
    echo "=============================================" | tee -a "$log_file"
    echo "Executing: $file" | tee -a "$log_file"
    echo "======= Contents of $file =======" | tee -a "$log_file"
    cat "$file" 2>/dev/null | tee -a "$log_file"
    echo "=============================================" | tee -a "$log_file"

    # 执行文件,并同时在终端打印和日志保存
    bash "$file" | tee -a "$log_file"

    echo "✅ Execution of $file completed!" | tee -a "$log_file"
done

# ✅ 并行执行 run_16 里面的所有命令
run_16_file="$runfiles_path/run_16"
log_16="$log_dir/run_16.log"

if [ -f "$run_16_file" ]; then
    echo "🔄 开始并行执行 run_16 命令..." | tee -a "$log_16"
    cat "$run_16_file" | tee -a "$log_16" | parallel -j 8 --joblog "$log_dir/parallel_run_16.log" | tee -a "$log_16"
    echo "✅ run_16 命令全部执行完成!" | tee -a "$log_16"
else
    echo "⚠️ 警告:run_16 文件未找到,跳过该步骤!" | tee -a "$log_dir/run_all.log"
fi

echo "✅ 所有任务已按顺序执行完成!" | tee -a "$log_dir/run_all.log"
相关推荐
小池先生31 分钟前
activemq延迟消息变成实时收到了?
linux·数据库·activemq
zl21878654481 小时前
Playwright同步、异步、并行、串行执行效率比较
开发语言·python·测试工具
larance1 小时前
asyncio数据流
python
tryCbest1 小时前
Linux系统下安装使用Redis
linux·运维·redis
eqwaak02 小时前
Flask实战指南:从基础到高阶的完整开发流程
开发语言·后端·python·学习·flask
AuroBreeze2 小时前
xv6-2023 - primes Lab
linux·运维·服务器
DIY机器人工房3 小时前
NAT 模式、命令行版、桥接模式方式给ubuntu虚拟机配网步骤:
linux·网络协议·ubuntu·嵌入式·桥接模式·diy机器人工房
wdfk_prog3 小时前
[Linux]学习笔记系列 -- lib/sort.c 通用的排序库(Generic Sorting Library) 为内核提供标准的、高效的排序功能
linux·运维·c语言·笔记·stm32·学习·bug
闲人编程4 小时前
深入理解Python的`if __name__ == ‘__main__‘`:它到底做了什么?
服务器·数据库·python·main·name·魔法语句