Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Has it ever started up properly or is this your first try? Does it require any special shell environment variables that might be present in a login shell but not in the init environment? –  Caleb Aug 4 '11 at 11:14
    
This is the first time. It can be start in 3 ways: 1. use --home, 2. execute the command from tyrant home, 3. set the TYRANT_MANAGER_HOME env. I choose the option 1. for ensure. –  quanta Aug 4 '11 at 11:24
    
Which user do you usually start it as from the command line? root or some other user? –  EightBitTony Aug 4 '11 at 11:26
    
@EightBitTony: I use root user. –  quanta Aug 4 '11 at 11:29
    
Is there nothing in any of the startup log files to indicate what might have happened? Otherwise, all I can suggest is what you've already suggested - record the output and test. –  EightBitTony Aug 4 '11 at 11:32

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
OK, solved it. The lesson is always export the PATH before running any 'special' commands not in the default path (/sbin:/usr/sbin:/bin:/usr/bin). /etc/profile will not being source when running rc.local. –  quanta Aug 5 '11 at 19:47

No matter what distro I nowadays use, I have learnt my lesson: if I want to make sure something comes up at boot, I will reboot the server and see what happens. Just schedule a maintenance window for your server (if needed) and perform couple of test restarts at that time. See if it works.

In the past I've been sure that "this will start during next reboot", but then it will not.

share|improve this answer
1  
+1 There is a lot of wisdom in this. No matter how many things you think you've done right, there is no substitute for actual testing. –  Caleb Aug 4 '11 at 11:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.