WebFaction
Community site: login faq
0
2

Hello,

I often work under a firewall protected network. This means that I can update my whole web faction hosted web site using ftp and django admin but I'm not able to restart the apache server as ssh beyond the firewall is not allowed. I can overcome this problem using ssh made with my mobile device (connected to internet through the cellular network) but I think it would be a nice idea to have the possibility to do an "apache2/bin/restart" from the control panel.

Did someone else face this problem yet?

Thanks

Carlo

asked 11 Aug '11, 06:39

viggio24
734
accept rate: 0%


I agree, it would be good to have a way to restart apps via the control panel. That's something we're planning to add to a future version of the panel, but we don't have an ETA yet.

In the meantime, you can use a simple CGI script to restart your app via the web.

First, create a static/cgi/php app in the control panel. You can name the app whatever you want.

Add password protection to the new app directory by following our instructions: Password Protecting a Directory with a Static/CGI/PHP App

Create a file named "restart.py" in your new app directory with the following contents (changing "you" and "your_app" to your username and app name respectively) :

#!/usr/local/bin/python2.7

import os, time

os.system("/home/you/webapps/your_app/apache2/bin/restart")

time.sleep(3)

print "Content-Type: text/plain"
print
print "Your app has been restarted."

Next, make the script executable: chmod 711 restart.py

Finally, add the static/cgi/php app to a site.

Once that's all done, you can restart your app by going to whatever URL you assigned to the static/cgi/php app, followed by the script name, eg http://domain.com/restart.py

Hope that helps!

permanent link

answered 11 Aug '11, 12:51

seanf
12.2k41836
accept rate: 37%

edited 11 Aug '11, 12:52

Thanks! your solution worked perfectly...

(12 Aug '11, 03:22) viggio24
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×24
×24
×7

question asked: 11 Aug '11, 06:39

question was seen: 7,764 times

last updated: 12 Aug '11, 03:22

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM