# Restarting apps on reboot

**URL:** <https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165>\
**Category:** Rails\
**Created:** [April 18, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165 "2008-04-18T18:14:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 18, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/1 "2008-04-18T18:14:49Z")

</div>

i have an unbuntu server that i installed rails on using the free  
peepcode screencast on deprec.

all is well unless the computer restarts. none of the apps come up on  
their own, and if i try to restart them with capistrano, it tells me  
that the old mongrel pids are still there and it cannot start.

right now i am manually having to go to each app and run rake  
tmp:pids:clear and then restart the mongrel\_cluster.

how can i get capistrano to clear these automatically, and what are my  
options for starting apps when the server is rebooted and keeping them  
running?

thanks

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 18, 2008, 7:29pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/2 "2008-04-18T19:29:48Z")

</div>

Josh K. wrote:

> i have an unbuntu server that i installed rails on using the free  
> peepcode screencast on deprec.
> 
> all is well unless the computer restarts. none of the apps come up on  
> their own, and if i try to restart them with capistrano, it tells me  
> that the old mongrel pids are still there and it cannot start.
> 
> right now i am manually having to go to each app and run rake  
> tmp:pids:clear and then restart the mongrel\_cluster.
> 
> how can i get capistrano to clear these automatically, and what are my  
> options for starting apps when the server is rebooted and keeping them  
> running?

I know next to nothing about Capistrano or linux, but I’m pretty sure  
you can achieve your goal without Capistrano. I know, super helpful  
right? Look on the bright side – posts with at least one reply  
generally get more than posts with no replies. 🙂

Also, this _might_ help:  
[https://support.railsmachine.com/index.php?pg=kb.page&id=122](https://support.railsmachine.com/index.php?pg=kb.page&id=122)

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 18, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/3 "2008-04-18T20:00:44Z")

</div>

Well, I don’t use capistrano (although I really should start to) but I  
have ran into the same problem myself and I run several RoR sites with  
their own set of pid’s.

I have a script that on a reboot starts them all up and my only way  
around it was to check if their were any PID fikes in the folder if  
their are to just remove them and start things up I also cross  
reference with ps to make sure it is not running but that is not  
really needed as mongrel is pretty good at not starting up if  
something is already running.

Nes++

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 18, 2008, 8:41pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/4 "2008-04-18T20:41:55Z")

</div>

Josh K. wrote:

> i have an unbuntu server that i installed rails on using the free  
> peepcode screencast on deprec.
> 
> all is well unless the computer restarts. none of the apps come up on  
> their own, and if i try to restart them with capistrano, it tells me  
> that the old mongrel pids are still there and it cannot start.
> 
> right now i am manually having to go to each app and run rake  
> tmp:pids:clear and then restart the mongrel\_cluster.
> 
> how can i get capistrano to clear these automatically, and what are my  
> options for starting apps when the server is rebooted and keeping them  
> running?
> 
> thanks

I imagine you have some scripts in /etc/init.d to bring the mongrels up?

By restart do you mean “Crash” (no shutdown invoked), or an ordinary  
reboot (shutdown invoked)?

I have the problem for the “crash” case, with scripts in /etc/init.d to  
bring up the mongrels. They do not get started, if the pid files are  
still there.

Two possibilities mentioned on the web:

At [LogLibrary.com is for sale | HugeDomains](http://rails.loglibrary.com/archives/2007/01/02)

eureka: awesome. so only remaining thing is setup a rc.d startup file  
that, when your machine reboots, finds .pid files and removes them.  
01:56:31 zedas eureka: then you’re all set

At [http://rubyforge.org/pipermail/mongrel-users/2007-March/003371.html](http://rubyforge.org/pipermail/mongrel-users/2007-March/003371.html)  
there is mention of “stale pid files” which might allow a “proper  
solution”.

(This problem might be something for the mongrel mailing list.)

Stephan

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 18, 2008, 9:06pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/5 "2008-04-18T21:06:57Z")

</div>

Josh K. wrote:

> i found what i needed here  
> [http://paulgoscicki.com/archives/2008/03/mongrel\_cluster-not-starting-after-hard-reboot/](http://paulgoscicki.com/archives/2008/03/mongrel_cluster-not-starting-after-hard-reboot/)
> 
> just edited /etc/init.d/mongrel\_cluster and added the --clean option  
> and everything works great!

Hey, thanks! Excellent.

Stephan

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 18, 2008, 8:51pm UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/6 "2008-04-18T20:51:56Z")

</div>

i found what i needed here  
[http://paulgoscicki.com/archives/2008/03/mongrel\_cluster-not-starting-after-hard-reboot/](http://paulgoscicki.com/archives/2008/03/mongrel_cluster-not-starting-after-hard-reboot/)

just edited /etc/init.d/mongrel\_cluster and added the --clean option  
and everything works great!

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [April 21, 2008, 5:46am UTC](https://www.ruby-forum.com/t/restarting-apps-on-reboot/135165/7 "2008-04-21T05:46:02Z")

</div>

instead of usng capistrano at d start up.try usng mongrel-cluster as a  
startup
