# PID problem with power outage

**URL:** <https://www.ruby-forum.com/t/pid-problem-with-power-outage/90832>\
**Category:** Deployment\
**Created:** [April 2, 2007, 6:59am UTC](https://www.ruby-forum.com/t/pid-problem-with-power-outage/90832 "2007-04-02T06:59:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kckckc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@kckckc](https://www.ruby-forum.com/u/kckckc)\
**Post date:** [April 2, 2007, 6:59am UTC](https://www.ruby-forum.com/t/pid-problem-with-power-outage/90832/1 "2007-04-02T06:59:02Z")

</div>

We have unique problem. We live in India where we have power outage for  
at least 10-20 mins - once or twice a day. We run a small demo server  
where I deploy “in progress” apps for my clients. We have been using and  
evangalising RoR since 8-10 months now in our organisation.

I have mongrel configured to serve out the web apps and it dutifully  
stops and starts during system shutdown/reboot. The problem is when I  
have an unexpected power outage. (I know I should have a UPS/power  
backup and I will be getting one soon but the problem still cannot be  
ignored and a UPS is at best a temporary solution.)

When power is cut off to the server, the ‘mongrel.xxxport.pid’ files  
remain in the respective log directories and prevent the mongrel servers  
from starting up. I have to manually delete them and restart the  
mongrels. Is there any way I can avoid manual intervention? (I could  
write a script to delete the pids and put it in run level 3 but that is  
pretty ugly.)

This problem does not exist with any other server -  
apache/postfix/subversion… and I do not think it should exist with  
mongrel either. Do let me know if I can help. I have done socket  
programming in ‘C’ before and have really smart people with ruby  
knowledge.

Thanks,  
kc

> **[www.rknowsys.com](https://www.rknowsys.com/)**
>
> https://www.rknowsys.com

---

<div class="post-metadata">

**Author:** ![kckckc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@kckckc](https://www.ruby-forum.com/u/kckckc)\
**Post date:** [April 2, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/pid-problem-with-power-outage/90832/2 "2007-04-02T17:35:47Z")

</div>

[http://textsnippets.com/posts/show/931](http://textsnippets.com/posts/show/931)

---

<div class="post-metadata">

**Author:** ![kckckc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@kckckc](https://www.ruby-forum.com/u/kckckc)\
**Post date:** [April 2, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/pid-problem-with-power-outage/90832/3 "2007-04-02T21:57:38Z")

</div>

On Apr 1, 9:59 pm, kc [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When power is cut off to the server, the ‘mongrel.xxxport.pid’ files  
> remain in the respective log directories and prevent the mongrel servers  
> from starting up. I have to manually delete them and restart the  
> mongrels. Is there any way I can avoid manual intervention? (I could  
> write a script to delete the pids and put it in run level 3 but that is  
> pretty ugly.)

I’ve been running mongrel\_cluster on Debian, and putting my .pid files  
in /tmp. Debian empties out /tmp on reboot, so this has worked fine.  
I should look in to what kind of housecleaning goes on with properly  
putting .pid files in /var/run, but I haven’t.
