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"
相关推荐
weixin_445054728 分钟前
力扣热题53
开发语言·python
南烟斋..9 分钟前
Linux系统编程核心知识指南
linux·算法
数据大魔方20 分钟前
【期货量化实战】豆粕期货量化交易策略(Python完整代码)
开发语言·数据库·python·算法·github·程序员创富
@汤圆酱25 分钟前
【无标题】
python·jmeter
森旺电子32 分钟前
Linux指令快速记忆
linux·运维·服务器
内存不泄露34 分钟前
基于 Spring Boot 的医院预约挂号系统(全端协同)设计与实现
java·vue.js·spring boot·python·flask
码农幻想梦37 分钟前
实验7 知识表示与推理
开发语言·人工智能·python
写代码的【黑咖啡】41 分钟前
深入理解 Python 中的 SQLAlchemy
开发语言·python·oracle
未定义.2211 小时前
第1篇:0基础入门!Python+Selenium环境搭建与第一个自动化脚本
python·功能测试·selenium·自动化·jenkins·pytest
特行独立的猫1 小时前
python+Proxifier+mitmproxy实现监听本地网路所有的http请求
开发语言·爬虫·python·http