如何testing/etc/rc.d/rc.local以确保命令将在启动时成功启动?

我正在使用暴君pipe理者pipe理东京暴君的几个实例。 这工作正常。

我想让它在启动时启动,所以我将下面的命令添加到/etc/rc.local

 /usr/local/bin/tyrantmanager start --home=/data/tyrant/ 

(当从命令行执行时,这将是确定的)

上周,我的服务器被绞死,我必须重新设置。 启动后,login并检查我看到没有东京暴君实例运行。

有什么方法可以testing,以确保它在下次启动时成功启动? 除了使用>> /var/log/tyrantmanager.log 2>&1将输出和错误redirect到一个日志文件外,如果它仍然无法启动,我还能做些什么来“debugging”。

PS:我可以为它编写一个初始化脚本,但仍然要检查这种情况的根本原因。


编辑:我已经在dev服务器上testing,得到了相同的结果。 以下是日志文件:

 15:02:17 INFO : Starting test : ttserver -host 192.168.xx -port 1978 -thnum 8 -tout 15 -dmn -pid /opt/tyrant/instances/test/test.pid -log /opt/tyrant/instances/test/log/test.log -le -ulog /opt/tyrant/instances/test/ulog -ulim 1g -rts /opt/tyrant/instances/test/test.rts /opt/tyrant/instances/test/data/test.tch#opts=ld#mode=wc /usr/local/lib/ruby/gems/1.8/gems/logging-1.5.2/lib/logging/logger.rb:429: command not found: ttserver -host 192.168.xx -port 1978 -thnum 8 -tout 15 -dmn -pid /opt/tyrant/instances/test/test.pid -log /opt/tyrant/instances/test/log/test.log -le -ulog /opt/tyrant/instances/test/ulog -ulim 1g -rts /opt/tyrant/instances/test/test.rts /opt/tyrant/instances/test/data/test.tch#opts=ld#mode=wc 

我不熟悉Ruby,所以我不知道为什么通过logger.rb 发现“command not found”错误。 也许我会问在stackoverflow上的问题。

看起来像:

  • 当/etc/rc.local运行时,ttserver不在path中。 确保/etc/rc.local中的环境设置正确。 正如你所说,它从命令行工作。
  • ruby脚本正在调用整个命令string作为一个单一的命令没有任何参数。

我怀疑第一个。

不pipe我现在使用什么发行版,我都吸取了教训:如果我想确保启动时出现问题, 我将重启服务器,看看会发生什么 。 只需为您的服务器安排一个维护窗口(如果需要的话),并在那时执行几次testing重启。 看看它是否有效。

在过去,我确定“这将在下次重启时开始”,但是不会。