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"
相关推荐
万千思绪10 分钟前
【PyCharm 2025.1.2配置debug】
ide·python·pycharm
饥饿的半导体22 分钟前
Linux快速入门
linux·运维
BD_Marathon32 分钟前
Ubuntu:Tomcat里面的catalina.sh
linux·ubuntu·tomcat
BD_Marathon32 分钟前
设置LInux环境变量的方法和区别_Ubuntu/Centos
linux·ubuntu·centos
Me4神秘36 分钟前
Linux国产与国外进度对垒
linux·服务器·安全
zhaowangji1 小时前
ubuntu 20.04 安装中文输入法 (sougou pin yin)
linux·ubuntu
两斤半2 小时前
Debian TTY环境乱码
linux·debian
微风粼粼2 小时前
程序员在线接单
java·jvm·后端·python·eclipse·tomcat·dubbo
云天徽上2 小时前
【PaddleOCR】OCR表格识别数据集介绍,包含PubTabNet、好未来表格识别、WTW中文场景表格等数据,持续更新中......
python·ocr·文字识别·表格识别·paddleocr·pp-ocrv5
你怎么知道我是队长2 小时前
python-input内置函数
开发语言·python