</pre> is based on the version number of the business today. The use of Maven and tomcat <p></p><p> assumes that we use jenkins to publish is relatively good, but there are certain problems, that is, the need to study time, </p><p > based on our project. I use Python to proactively build publishing environments </p><p> scripts such as the following: </p><p></p><pre code_snippet_id= "498203" Snippet_file_name= "blog_20141027_2_7484436" name= "code" class= "python" >#!/usr/bin/env python#-*-coding:utf-8-* -import sysimport Osimport configparserhomedir = OS.GETCWD () Print homedirconfig = Configparser.configparser () Config.read ("config.propties") user_name = Config.get ("SVN", "user_name"). Decode (' UTF8 '). Encode (' cp936 ') user_ Password = config.get ("SVN", "User_password"). Decode (' UTF8 '). Encode (' cp936 ') Check_out_dir = Homedirlog_name = Config.get ("SVN", "Log_name"). Decode (' UTF8 '). Encode (' cp936 ') Script_dir = homedirpkg_name=homedir+os.path.sep+ " Mabaobang-web "+os.path.sep+" target "+os.path.sep+" Mabaobang-web.war "Rmote_ip=config.get (" SVN "," rmote_ip ") Rmote_ User=config.get ("svn", "Rmote_user") rmote_passwd=config.get ("svn", "Rmote_pasSWD ") print" Pkg_name ", Pkg_namescript_dir=config.get (" SVN "," Script_dir "). Decode (' UTF8 '). Encode (' cp936 ') command =" SVN log-v--xml "+ Check_out_dir +" > "+ log_name +"--username "+ user_name +"--password "+ User_passwordos. System (Command) Os.chdir (check_out_dir) Print Os.path.abspath ("."). Decode (' cp936 '). Encode (' UTF8 ') command1= "svn update" + Check_out_dir + "--username" + user_name + "--password" + user_ Password + "--no-auth-cache--non-interactive--trust-server-cert" Os.system (Command1) os.system ("Mvn Clean:clean Package "), File_object = open (' 123123.txt ', ' W ') file_object.write (" Open 192.168.15.234\n ") file_object.writelines (" Put "+pkg_name+" \ n ") #file_object. Writelines (file.newlines) file_object.writelines (" bye\n ") #file_ Object.writelines (File.newlines) #file_object. Writelines (File.newlines) File_object.flush () File_object.close () if Os.path.exists (pkg_name): Os.chdir (homedir) try:command_sftp= "ftp.exe-l" + Rmote_user + "-PW" +rmote_passwd + "-B 123123.txt" Os.system (command_sftp) except exception,e:print "Done" finally:command_ssh= "ssh.exe-ssh -PW "+ rmote_passwd +" "+rmote_passwd+" @192.168.15.234 '/home/momabo/deploy.sh ' "Os.system (COMMAND_SSH)
Configuration files such as the following:
[Svn]user_name=111111user_password=000000#check_out_dir=d:\11111\1111-parentlog_name=e:\log.log#out_put_dir=d : \1111\111-parent#war_name=d:\11111111-parent\11111111111111-web\target\111111111-web.warrmote_ip= 192.168.15.234rmote_user=xxxx
Need two open source soft Sftp.exe Http://the.earth.li/~sgtatham/putty/0.63/x86/psftp.exe
and Ssh.exe http://the.earth.li/~sgtatham/putty/0.63/x86/plink.exe to download it.
Self-proactively publish background scripts
!/bin/bash # # #?The Lu Mei?
The cat???? The burrow. Lou Lu Lu Lu?
Donkey?
Recorded??? Busy # # #碌?? Lu, Lu Lu, the record spear-Mao?
??
Lou Lu?
The eyebrow?? Road cap?? The LU Lu Lu Lu?? The donkey record??
user_home=/home/3213123tomcat_home=${user_home}/tomcat# Lu Lou?? Lu??
The donkey recorded app_home=${tomcat_home}/webapps/12313123-webconf_file=${app_home}/web-inf/classes/config.propertiesip_add=. 127.0.0.1mysql_user_name=rootmysql_user_passwd=213131upload_dir=/home/312312312/upload## #碌?
? Lu Mao Lu Lu, the record spear?
?
?
The brow of Lou Lu?
The road cap?? The LU Lu Lu Lu?
?
The donkey record?? Luan If [!-F ${user_home}/mabaobang-web.war];then echo-e "\033[31m error:pkg ${user_home}/mabaobang-web.war is not ex Ist. \033[0m "Exit 1fi### #碌?
Magnesium ${tomcat_home}/bin/shutdown.sh####, Lu Lu, a road????? of the MG-F-Road if [!-D ${app_home}];then echo-e "\033[31m error:dir ${app_home} is not exist. \033[0m "Exit 1else rm-rf ${app_home}/*fimv ${user_home}/1312313-web.war ${app_home}/cd ${tomcat_home}/webapps/m3123 21G-WEBJAR-XVF ${app_home}/3132133-web.war##?? Bribery?? Blind???? Recorded magnesium Dos2unix ${conf_file}##?? Bribery?? Blind??
?
Sed-i mg "s/\/\/127.0.0.1/\/\/${ip_add}/g" ${conf_file}sed-i "s/^[]*jdbc_username=.*/jdbc_username=${mysql_user_ Name}/g "${conf_file}sed-i" s/^[]*jdbc_password=.*/jdbc_password=${mysql_user_passwd}/g "${CONF_FILE}
Web Self-initiative announcement