|
- #!/usr/bin/python
- #coding:utf-8
- ### 导入模块
- import time
- import os
- import shutil
- #定义变量
- date = time.strftime("%m%d")
- src1 = "/root/"+date+"/WebContent"
- src2 = "/root/"+date+"/yiren.war"
- src3 = "/root/default-web.xml"
- src4 = "/root/domain.xml"
- comm1 = "\cp -rf " +src1 +" /opt/nginx/www.zhouheyun.com/"
- comm2 = "asadmin -W /etc/gf.pass deploy "+src2
- dst = "/tmp"
- #print "today is:", date
- if os.path.exists(src1):
- # shutil.copy(src1, dst)
- os.system(comm1)
- print "statis is OK!"
- else:
- print "static is not deploy!"
- if os.path.exists(src2):
- os.system('asadmin -W /etc/gf.pass undeploy yiren')
- os.system(comm2)
- shutil.copy(src3, "/usr/local/glassfish3/glassfish/domains/yiren/config/")
- shutil.copy(src4, "/usr/local/glassfish3/glassfish/domains/yiren/config/")
- os.system('asadmin restart-domain')
- print "deploy sucessfull"
- else:
- print "nothing to do !"
|
|
|