-1

I am using an apache webserver which has several applications on it.

I need to restart one specific ruby on rails application.

In the phusion passenger documentation, it mentions that there are 2 ways of doing so:

  1. By restarting Apache.
  2. By creating or modifying the file tmp/restart.txt in the Rails application’s root folder. Phusion Passenger will automatically restart the application during the next request.

For example, to restart our example MyCook application, we type this in the command line:

touch /webapps/mycook/tmp/restart.txt

I don't want to restart the whole webserver, just my rails app. My rails app folder is called sub_interface.

I created an empty text file called restart.txt in the tmp folder and ran the comman

touch htdocs/sub_interface/tmp/restart.txt

Nothing happened. That file is empty.

How do I restart only my rails application without restarting the entire web server?

migrated from stackoverflow.com Aug 24 '12 at 1:58

This question came from our site for professional and enthusiast programmers.

1

There is no need to create the file before issuing the touch command. 'touch' creates an empty file, or if the file exists, it updates the file changed date.

Are you sure httpd.conf is loading the app on htdocs/sub_interface? If so, are you sure passenger didn't restart the app when you created the file tmp/restart.txt?

1

Nothing happened. That file is empty.

This is what you'd expect - an empty file at ./tmp/restart.txt and no other changes till you try reloading a page. This will restart the app next time you load it, however you may not see refreshed content if (for example) you have enabled caching (page, action or fragment).

To test you are looking at the right folder, cd to sub_interface and do this:

touch ./public/test.txt

Then visit mywebsite.com/test.txt, and check that a blank page (and not a 404 is served).

Then to test that the website is indeed restarting, change an existing action by adding

redirect_to :root and return 

at the start and touch ./tmp/restart.txt again - if you visit the action web page (say mywebsite.com/users) and it redirects, you know the restart has worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy