目录
1. 按顺序逐个执行py文件
(Trick: 确认程序能跑通后、自动化执行1.py、2.py等,并将中间过程输出到日志1.log、2.log,不用一直盯着程序了)
#!/bin/bash
### cd 目录
# 1.py
echo "$(date): 1.py starting..."
nohup python 1.py &> 1.log 2>&1 &
1_id=$! # 进程ID - movie.py
wait $1_id
echo "$(date): sleep 120s..."
sleep 120
### 2.py
echo "$(date): 2.py starting..."
nohup python 2.py &> 2.log 2>&1 &
2_id=$! # 进程ID - movie.py
wait $2_id
echo "$(date): sleep 120s..."
sleep 120
### end
echo "$(date): Script finished"