我知道这有点泛泛,但我相信你会理解我的解释。情况如下:如何在硬件故障后恢复此脚本?
以下代码每10分钟执行一次。当变量“var_x”被引用时,它总是读/写到外部文本文件中。
if (var_x != 1)
{
var_x = 1;
//
// here is where the main body of the script is.
// it can take hours to completely execute.
//
var_x = 0;
}
else
{
// exit script as it's already running.
}
的问题是:如果我模拟硬件故障(做当脚本执行硬复位),则主要脚本逻辑永远不会再执行,因为“var_x”永远是“1” 。 (我已经有了计算还原点的逻辑)。
谢谢。
由于某种原因,Flock似乎不适合我。 羊群似乎只推迟代码,直到文件变得自由,这是不是我想要的。 – Cheetah 2009-09-04 20:21:09