|
|
@ -1,9 +1,16 @@ |
|
|
|
from bs4 import BeautifulSoup |
|
|
|
from bs4 import BeautifulSoup |
|
|
|
import os |
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file_name = "/var/www/html/index.html" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if the file doesn't exist, we should copy the template to the folder |
|
|
|
|
|
|
|
if not os.exists(file_name): |
|
|
|
|
|
|
|
template_name = "index.html" |
|
|
|
|
|
|
|
shutil.copy(template_name, file_name) |
|
|
|
|
|
|
|
print("The index file was not available, so we've restored it from template.") |
|
|
|
|
|
|
|
|
|
|
|
fortune = os.popen("/usr/games/fortune | /usr/games/cowsay").read() |
|
|
|
fortune = os.popen("/usr/games/fortune | /usr/games/cowsay").read() |
|
|
|
|
|
|
|
|
|
|
|
file_name = "/var/www/html/index.html" |
|
|
|
|
|
|
|
soup = None |
|
|
|
soup = None |
|
|
|
|
|
|
|
|
|
|
|
print("The emergency fortune system has set the fortune to {}".format(fortune)) |
|
|
|
print("The emergency fortune system has set the fortune to {}".format(fortune)) |
|
|
|