downloadFileDaemon.sh 456 B

12345678910111213141516171819
  1. #!/bin/bash
  2. source /opt/py312/bin/activate
  3. # 进入脚本目录确保路径正确
  4. cd "$(dirname "$0")" || exit 1
  5. # 捕获终止信号
  6. trap 'kill $SPIDER_PID; exit' SIGINT SIGTERM
  7. while true; do
  8. echo "$(date): 启动专项债附件下载器..."
  9. nohup python3 /mnt/download_files/crawl_detail_spider.py > /dev/null 2>&1 &
  10. SPIDER_PID=$!
  11. wait $SPIDER_PID
  12. echo "$(date): 专项债附件下载器进程已终止,1秒后重启..."
  13. sleep 1
  14. done