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.
Niall M. (Guest)
on 2007-05-21 14: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 M.
(Guest)
on 2007-05-21 20: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
Niall M. (Guest)
on 2007-05-21 22: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 M.


removed_email_address@domain.invalid wrote:
>> I didn't find out about this reboot until several hours later so the
>>
>> Niall M.
>
>
> >
>

--
Niall M.
4L Communications Ltd.
http://www.4L.ie/
Daniel J. (Guest)
on 2007-05-21 23: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 J.
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]
Vishnu G. (Guest)
on 2007-05-22 00:33
(Received via mailing list)
or do it with --clean to mongrel_cluster?

Vish
Bradley Taylor (Guest)
on 2007-05-22 00: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
Jim K. (Guest)
on 2007-05-23 17:41
(Received via mailing list)
On May 21, 5:46 am, Niall M. <removed_email_address@domain.invalid> 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
Niall M. (Guest)
on 2007-05-23 18:16
(Received via mailing list)
Thanks for that Jim, will definitely look into both options.

And thanks for the other responses as well.

Niall


removed_email_address@domain.invalid wrote:
> Hello Niall -- it looks like you have plenty of options for clearing
> satisfied user.
>
> Jim
>
>
> >
>

--
Niall M.
4L Communications Ltd.
http://www.4L.ie/
David H. (Guest)
on 2007-06-21 01:21
Niall M. 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 M.

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?
Raul (Guest)
on 2007-06-21 01:26
(Received via mailing list)
Yeah look at this:  http://textsnippets.com/posts/show/931

Works a treat!



----- Original Message -----
From: "David H." <removed_email_address@domain.invalid>
To: <removed_email_address@domain.invalid>
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.