login community 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 Aug 11 '11 at 06:39

viggio24's gravatar image

viggio24
73


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) :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/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!

answered Aug 11 '11 at 12:51

seanf's gravatar image

seanf ♦♦
55991220

edited Aug 11 '11 at 12:52

Thanks! your solution worked perfectly...

(Aug 12 '11 at 03:22) viggio24 viggio24's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
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

Tags:

×641
×18
×15
×5

Asked: Aug 11 '11 at 06:39

Seen: 1,310 times

Last updated: Aug 12 '11 at 03:22

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited