4

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.

quanta
  • 50,327
  • 19
  • 152
  • 213
  • 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 04 '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 04 '11 at 11:24
  • Which user do you usually start it as from the command line? root or some other user? – EightBitTony Aug 04 '11 at 11:26
  • @EightBitTony: I use root user. – quanta Aug 04 '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 04 '11 at 11:32
  • have you checked and made sure /etc/rc.local is executable, check the boot log for a reason to its failure if it attempted to start – anthonysomerset Aug 04 '11 at 11:49
  • I've edited my post to add the log file. @anthonysomerset: it is executable. – quanta Aug 05 '11 at 18:06

3 Answers3

8

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.

Janne Pikkarainen
  • 31,454
  • 4
  • 56
  • 78
  • 2
    +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 04 '11 at 11:13
4

[Quick Answer]


To run rc.local manually, go to rc.local path (cd /etc/) then do as the following:

$ sudo ./rc.local

If you have an error for execution, do it before that:

$ sudo chmod +x rc.local
Benyamin Jafari
  • 213
  • 2
  • 5
1

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.

MikeyB
  • 38,725
  • 10
  • 102
  • 186
  • 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 05 '11 at 19:47