help with an init script
normalperson at yhbt.net
Thu Nov 10 06:20:14 EST 2011
Xavier Noria <fxn at hashref.com> wrote:
> Hey, I have this pretty standard init script for Unicorn
> fxn at cohen:~$ ls -la /etc/init.d/unicorn_home
> lrwxrwxrwx 1 root root 32 2011-11-09 23:45 /etc/init.d/unicorn_home
> -> /home/fxn/home/config/unicorn.sh
> fxn at cohen:~$ ls -la $HOME/.rvm/bin/ruby
> -rwxrwxr-x 1 fxn sudo 265 2011-11-09 21:44 /home/fxn/.rvm/bin/ruby
> and $APP_ROOT/bin/unicorn_rails is a binstub created by bundler.
Is /home mounted later in the boot process than when the
unicorn init script fires? unicorn should be one of the last things
to start if you're putting it in init.
> The init script works like a charm if I run it with sudo, but for some
> reason the service is not launched if the machine is rebooted.
> Do you know what could happen or how could I debug it? dmesg | grep
> unicorn prints nothing.
You could put the following near the top of the init script
(after "set -e"):
# make sure the directory for this file is something that persists
# throughout the boot process (isn't mounted-over by another dir):
rm -f "$ERR"
exec 2>> "$ERR"
# ... rest of the script
All stderr output (before unicorn is started) will then go to whatever
you set ERR to. If you got all the way to starting unicorn:
does the stderr log of unicorn have anything interesting? (please
configure stderr_path if you haven't already)
You can also add "set -x" to the init script and things will get
very verbose once you set it.
Can't think of much else on my sleep-deprived brain...
More information about the mongrel-unicorn