python 程序 不停地执行
#!/bin/bash
/usr/sbin/sshd
retry ()
{
false;
while [ $? -gt 0 ]; do
$@ || ( sleep 1 && false );
done
}
bash -c "retry stdbuf -o0 python src/main.py 2203 60 2" &
bash -c "retry stdbuf -o0 python src/parser.py" &
文章描述了一个bash脚本,该脚本用于启动sshd服务并后台运行两个Python脚本——main.py和parser.py。如果这些Python脚本失败,retry函数将尝试重新启动它们,确保程序的连续运行。
python 程序 不停地执行
#!/bin/bash
/usr/sbin/sshd
retry ()
{
false;
while [ $? -gt 0 ]; do
$@ || ( sleep 1 && false );
done
}
bash -c "retry stdbuf -o0 python src/main.py 2203 60 2" &
bash -c "retry stdbuf -o0 python src/parser.py" &

被折叠的 条评论
为什么被折叠?