在 WSL中批量执行InSAR任务-stackSentinel.py

在合成孔径雷达(SAR)数据处理中,批量执行多个任务并记录日志 是一个常见需求。这个 Bash 脚本 可以自动执行 run_01 到 run_16 的 InSAR 处理任务,并分别为每个任务创建日志文件,方便后续调试和分析。

当然这是单个文件单个运行哈 ,就是不用一直用手点啦

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_16,并记录各自的日志
for file in $(ls $runfiles_path/run_??_* 2>/dev/null | 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

echo "✅ 所有任务已按顺序执行完成!" | tee -a "$log_dir/run_all.log"
bash 复制代码
自动遍历 run_01 ~ run_16 并执行
为每个 run_xx_* 任务生成单独的日志文件
在终端显示执行过程,同时保存到日志
最终汇总所有任务的执行情况到 run_all.log	
相关推荐
Thanks_ks1 小时前
Python 的垃圾回收——引用计数撑起日常,分代回收收拾残局
python·内存管理·垃圾回收·循环引用·引用计数·gc 模块·weakref
CyrusYiVPP1 小时前
实测 uv 0.13.7:同一套包,pip 装 94 秒,它只用 19 秒
人工智能·python
kyle~1 小时前
嵌入式 SoC 系统
linux·c++·嵌入式·计算系统
yiangL_2 小时前
Python 学习笔记:递归、turtle绘图、字符串与函数
笔记·python·学习
lula8883 小时前
PVC-U、PVC-C、PVC-O 差一个字母,差的是三种增强路线
python
人生!?3 小时前
Linux 从入门到进阶 | 基础语法
linux·笔记·教程
数字工作台4 小时前
给 LangGraph 加一道可审计记忆:替换默认 Checkpointer,实现防篡改 + 崩溃不丢数据
python·agent
DKPT4 小时前
Python 的 Web 框架:选型选错的人,都踩了同一个坑
python
心之王者7164 小时前
Linux 进程信号:从产生、阻塞到捕捉与子进程回收
linux·服务器·网络
AndreaYYmm5 小时前
日志里 grep 到 Fail 就判失败?这六个假阳性我全踩过
linux·shell