unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* help with an init script
@ 2011-11-10 10:01 Xavier Noria
  2011-11-10 11:20 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier Noria @ 2011-11-10 10:01 UTC (permalink / raw)
  To: unicorn list

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.

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.
_______________________________________________
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: help with an init script
  2011-11-10 10:01 help with an init script Xavier Noria
@ 2011-11-10 11:20 ` Eric Wong
  2011-11-10 13:28   ` Xavier Noria
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2011-11-10 11:20 UTC (permalink / raw)
  To: unicorn list

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: help with an init script
  2011-11-10 11:20 ` Eric Wong
@ 2011-11-10 13:28   ` Xavier Noria
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier Noria @ 2011-11-10 13:28 UTC (permalink / raw)
  To: unicorn list

For the archives: I am sure I am missing something easy here, but
anyway since I like to think about the app as something mostly local
to the user running under the user's rvm, I launch Unicorn on reboot
via the user's crontab:

    @reboot /home/fxn/home/config/unicorn.sh start

That worked out of the box.

Thanks Eric!
_______________________________________________
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-10 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 10:01 help with an init script Xavier Noria
2011-11-10 11:20 ` Eric Wong
2011-11-10 13:28   ` Xavier Noria

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).