如何从脚本内部重新启动ruby脚本?

时间:2016-01-16 14:13:02

标签: ruby

我正在寻找一种方法来停止当前运行的脚本并在满足延续时重新启动它。

我该怎么做?

1 个答案:

答案 0 :(得分:4)

像这样写:

at_exit{
  # whatever way you started the program originally such as `program_name`.
  # Make sure that the new process is detached from the original.
}

然后执行:

exit

你想打破的地方。