Skip to content

Instantly share code, notes, and snippets.

@yayyz
Created September 29, 2019 13:19
Show Gist options
  • Save yayyz/eefdbba1b746ac1ca2242b5dac966433 to your computer and use it in GitHub Desktop.
Save yayyz/eefdbba1b746ac1ca2242b5dac966433 to your computer and use it in GitHub Desktop.
maintenance.py
'''
$> python3 maintenance.py [app_name] [on/off]
status = [on, off]
app_name = [서비스명]
@author yeji im
'''
import sys, os, time, os.path
CONSTRUCTION_BASE="[maintenance file path]"
def construction_site():
app_name = sys.argv[1]
status = sys.argv[2]
CONSTRUCTION_BASE = CONSTRUCTION_BASE + app_name + "/"
new_file_name = "maintenance_" + status + ".html"
old_file_name = "maintenance_";
if status == "off":
old_file_name = old_file_name + "on.html"
else:
old_file_name = old_file_name + "off.html"
# change maintenance file
os.rename(CONSTRUCTION_BASE + old_file_name, CONSTRUCTION_BASE + new_file_name)
construction_site()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment