unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: help with an init script
Date: Thu, 10 Nov 2011 11:20:14 +0000	[thread overview]
Message-ID: <20111110112014.GA23753@dcvr.yhbt.net> (raw)
In-Reply-To: <CAM=YcdiXa14X3fC_rE=pOZHLz4zGxUe1UpmSgXq=0QR6_hWt9w@mail.gmail.com>

Xavier Noria <fxn@hashref.com> wrote:
> Hey, I have this pretty standard init script for Unicorn
> 
>    http://pastie.org/2840779
> 
> where
> 
>    fxn@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@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):
	ERR=/var/tmp/unicorn.init.err
	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...
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

  reply	other threads:[~2011-11-10 11:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 10:01 help with an init script Xavier Noria
2011-11-10 11:20 ` Eric Wong [this message]
2011-11-10 13:28   ` Xavier Noria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111110112014.GA23753@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).