Created
May 5, 2012 13:01
-
-
Save bbinet/2602183 to your computer and use it in GitHub Desktop.
ebenezer-ghp-update cgi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import cgi | |
import os | |
import sys | |
if os.environ["REMOTE_ADDR"] in ["207.97.227.253", "50.57.128.197", | |
"108.171.174.178", "89.88.161.33"]: | |
print "Content-type: text/plain" | |
print "" | |
cmd = "bash -c 'export HOME=/home/data" \ | |
"&& source /home/data/.venvburrito/startup.sh" \ | |
"&& workon ebenezer-bf.org" \ | |
"&& cd /home/data/dev/ghp-update/ebenezer-bf.org/" \ | |
"&& ../pull_and_ghpimport.sh _output \"make html\"'" | |
execution = os.popen(cmd, 'r', 0) | |
output = "".join(execution.readlines()) | |
execution.close() | |
print output | |
else: | |
print "Status: 403 Forbidden" | |
print "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment