Forum: Rails deployment Mongrel failing to start on bootup as PID files still exist

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4ebfebfcf19c7cb3d4f40607967f179f?d=identicon&s=25 Niall Mullally (Guest)
on 2007-05-21 12:48
(Received via mailing list)
Hi,
One of my site's servers had a problem yesterday and the host
restarted it.  During boot up Mongrel failed to start as the PID files
still existed in /log

I didn't find out about this reboot until several hours later so the
site was down that entire time which is less than ideal.

Does anybody know of a way around this?  Is there a built in way to
force Mongrel to start and overwrite any existing PID files?

I have the mongrel_cluster startup script setup correctly btw.

Thanks in advance.

Regards,

Niall Mullally
6925c1e7ea432d878f1832d857d6dfe8?d=identicon&s=25 richard.luther@gmail.com (Guest)
on 2007-05-21 18:35
(Received via mailing list)
You could write init.d script to check if those files exist and if so
delete them before trying to start up the cluster.
 - Richard
4ebfebfcf19c7cb3d4f40607967f179f?d=identicon&s=25 Niall Mullally (Guest)
on 2007-05-21 20:39
(Received via mailing list)
Thanks Richard, was thinking of doing that but was wondering if there
was an existing solution, one built into Mongrel perhaps.

Niall Mullally


richard.luther@gmail.com wrote:
>> I didn't find out about this reboot until several hours later so the
>>
>> Niall Mullally
>
>
> >
>

--
Niall Mullally
4L Communications Ltd.
http://www.4L.ie/
80968d131cffa2fb45a34ab6ebde209c?d=identicon&s=25 Daniel Johnson (Guest)
on 2007-05-21 21:06
(Received via mailing list)
> I have the mongrel_cluster startup script setup correctly btw.
I usually write some shell script to clear out the pid files, but
another way that works is to have mongrel put it's pid files in the /tmp
directory which gets emptied on restart.


--
Daniel Johnson
Systems Administrator

PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting

www.planetargon.com
http://teknot.us [blog]
teknotus [freenode IRC]
+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]
34f26dde337f0a0d2d380e11117e82f6?d=identicon&s=25 Vishnu Gopal (Guest)
on 2007-05-21 22:33
(Received via mailing list)
or do it with --clean to mongrel_cluster?

Vish
8c601de327b298fdfa2298d66451de21?d=identicon&s=25 Bradley Taylor (Guest)
on 2007-05-21 22:55
(Received via mailing list)
Hi:

Install the mongrel_cluster prerelease (soon to be released after I
recover from RailsConf) and change your pidfile location to /var/run/
mongrel_cluster (on linux). Be sure to copy the new init.d script out
of the gem source.

http://blog.railsmachine.com/2007/2/26/mongrel_clu...

Bradley
Beae3c4b7d0869b9dcd329406d936c1a?d=identicon&s=25 Jim Kane (bigjimmyk3)
on 2007-05-23 15:41
(Received via mailing list)
On May 21, 5:46 am, Niall Mullally <n...@4l.ie> wrote:
> Hi,
> One of my site's servers had a problem yesterday and the host
> restarted it.  During boot up Mongrel failed to start as the PID files
> still existed in /log
>
> I didn't find out about this reboot until several hours later so the
> site was down that entire time which is less than ideal.
Hello Niall -- it looks like you have plenty of options for clearing
out those pesky PID files, but no one has addressed this part of your
email.  Anything beyond a hobby site needs some sort of monitoring for
situations just like this.  At RailsConf, Ezra specifically mentioned
using monit (which I currently use) to monitor one's individual
mongrel processes.  If that sounds like too much work, an excellent
alternative is the free Heartbeat website (http://
heartbeat.highgroove.com/) which allows you to monitor multiple
application URLs and email yourself when things go awry.  I'd
encourage you to go sign up for heartbeat and see if using monit is
feasible for you.   No financial connection to either one, just a very
satisfied user.

Jim
4ebfebfcf19c7cb3d4f40607967f179f?d=identicon&s=25 Niall Mullally (Guest)
on 2007-05-23 16:16
(Received via mailing list)
Thanks for that Jim, will definitely look into both options.

And thanks for the other responses as well.

Niall


FastJames@gmail.com wrote:
> Hello Niall -- it looks like you have plenty of options for clearing
> satisfied user.
>
> Jim
>
>
> >
>

--
Niall Mullally
4L Communications Ltd.
http://www.4L.ie/
290fd6795af59caa5da38957340bc857?d=identicon&s=25 David Harkness (nullserver)
on 2007-06-20 23:21
Niall Mullally wrote:
> Hi,
> One of my site's servers had a problem yesterday and the host
> restarted it.  During boot up Mongrel failed to start as the PID files
> still existed in /log
>
> I didn't find out about this reboot until several hours later so the
> site was down that entire time which is less than ideal.
>
> Does anybody know of a way around this?  Is there a built in way to
> force Mongrel to start and overwrite any existing PID files?
>
> I have the mongrel_cluster startup script setup correctly btw.
>
> Thanks in advance.
>
> Regards,
>
> Niall Mullally

On a related note.
A script like this will kill any mongrel instance that is hanging around
after its pid file is gone.
#!/usr/local/bin/ruby
# 3000 is the port you wish to kill.
pid =  `lsof -i :3000`.split("\n")[1].split()[1] rescue nil
%x{kill -9 #{pid}} unless pid.nil?
8f977c0870d57e52e488dc3546fb7f24?d=identicon&s=25 Raul (Guest)
on 2007-06-20 23:26
(Received via mailing list)
Yeah look at this:  http://textsnippets.com/posts/show/931

Works a treat!



----- Original Message -----
From: "David Harkness" <ruby-forum-incoming@andreas-s.net>
To: <rubyonrails-deployment@googlegroups.com>
Sent: Wednesday, June 20, 2007 2:21 PM
Subject: [Rails-deploy] Re: Mongrel failing to start on bootup as PID
files
still ex
This topic is locked and can not be replied to.