How to test /etc/rc.d/rc.local to make sure a command will start successfully at boot

rc.localstartup

I'm using tyrantmanager to manage several instances of Tokyo Tyrant. It's working fine.

I want to get it to start at boot, so I add the following command into /etc/rc.local:

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

(this will be OK when doing from the command line)

Last week, my server hanged and I must hard reset. After booting, login to and check I see no Tokyo Tyrant instances running.

Is there any way to test to make sure it will start successfully at the next boot? Except of redirecting the output and error to a log file with >> /var/log/tyrantmanager.log 2>&1, what else can I do to 'debug' if it keep failing to start.

PS: I can write an init script for it but still want to examine the root cause for this case.


EDIT:
I've tested on the dev server and got the same result. Below is the log file:

15:02:17  INFO : Starting test : ttserver -host 192.168.x.x -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.x.x -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 

I'm not familiar with Ruby, so I don't know why it through the "command not found" error from logger.rb. Maybe I will ask the question on stackoverflow.

Best Answer

Looks like either:

  • ttserver isn't in the path when /etc/rc.local runs. Make sure that the environment is set up correctly in /etc/rc.local. As you say, it works from the command line.
  • the ruby script is calling the entire command string as a single command without any parameters.

I suspect the first.

Related Topic