def matchServer_exists(matchServer, ip):
with quiet():
exists = local('''grep "\\b{}\\b" /etc/hosts '''.format(matchServer)).succeeded
if exists:
raise Exception('''The match server {} already exists in /etc/hosts'''.format(matchServer))
else:
matchServer_dir_exists = execute(remote_dir_exists, '/app/{}'.format(matchServer), hosts=[ip])[ip]
if matchServer_dir_exists:
raise Exception('''The match dir: /app/{} already exists on {}'''.format(matchServer, ip))
#def create_nginx_conf(remote_dir):
# server_name = 'match_download_{}'.format(TIME)
# conf_name = 'download_{}.conf'.format(TIME)
# with cd('/app/nginx/conf/vhost'):
# run('''echo -e "server {\\n listen 80;\\n server_name %s;\\n root %s;\\n index Main.html;\\n access_log logs/default.access.log main;\\n location / {\\n expires 0;\\n }\\n\\n error_page 404 500 502 503 504 /404.html;\\n}" >%s''' % (server_name, remote_dir, conf_name))
评论列表
文章目录