首页 > 代码库 > 生产环境上线脚本(update.sh)
生产环境上线脚本(update.sh)
#!/bin/sh # Author: bobo365 Filelist=" web_trade 1 static 2 web_portfolio 3 web_live 4 web_topic 5 web_api 6 service_console 7 service_task 8 admin_crm 9 admin_admin 10 mobile_static 11 mobile_web 12 mobile_api 13 public_php 14 interface_package 15 combination 16 " while true do clear dialog --menu "Please choose the SVN dir" 20 40 10 $Filelist 2>/tmp/svn.txt result=$? if [ $result -eq 1 ] ; then exit 1; elif [ $result -eq 255 ]; then exit 255; fi Svn_Dir=$(cat /tmp/svn.txt) dialog --title "Update info" --form "Make sure the follow info right or not:" 12 60 5 "update dir:" 1 1 "$Svn_Dir" 1 15 40 0 result=$? if [ $result -eq 1 ] ; then exit 1; elif [ $result -eq 255 ]; then exit 255; fi #Svn_Dir=$(cat /tmp/svn.txt) case $Svn_Dir in web_trade) echo -e "\033[47;31m Delete /upload/web_trade \033[0m" rm -rf /upload/web_trade sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/web_trade \033[0m" sleep 2 svn export http://192.168.1.80/repos/web_trade /upload/web_trade --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; static) echo -e "\033[47;31m Delete /upload/static \033[0m" rm -rf /upload/static sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/static \033[0m" sleep 2 svn export http://192.168.1.80/repos/static /upload/static --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; web_portfolio) echo -e "\033[47;31m Delete /upload/web_portfolio \033[0m" rm -rf /upload/web_portfolio sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/web_portfolio \033[0m" sleep 2 svn export http://192.168.1.80/repos/web_portfolio /upload/web_portfolio --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; web_live) echo -e "\033[47;31m Delete /upload/web_live \033[0m" rm -rf /upload/web_live sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/web_live \033[0m" sleep 2 svn export http://192.168.1.80/repos/web_live /upload/web_live --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; web_topic) echo -e "\033[47;31m Delete /upload/web_topic \033[0m" rm -rf /upload/web_topic sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/web_topic \033[0m" sleep 2 svn export http://192.168.1.80/repos/web_topic /upload/web_topic --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; web_api) echo -e "\033[47;31m Delete /upload/web_api \033[0m" rm -rf /upload/web_api sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/web_api \033[0m" sleep 2 svn export http://192.168.1.80/repos/web_api /upload/web_api --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; service_console) echo -e "\033[47;31m Delete /upload/service_console \033[0m" rm -rf /upload/service_console sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/service_console \033[0m" sleep 2 svn export http://192.168.1.80/repos/service_console /upload/service_console --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; service_task) echo -e "\033[47;31m Delete /upload/service_task \033[0m" rm -rf /upload/service_task sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/service_task \033[0m" sleep 2 svn export http://192.168.1.80/repos/service_task /upload/service_task --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; admin_crm) echo -e "\033[47;31m Delete /upload/admin_crm \033[0m" rm -rf /upload/admin_crm sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/admin_crm \033[0m" sleep 2 svn export http://192.168.1.80/repos/admin_crm /upload/admin_crm --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; #manager and admin_admin admin_admin) echo -e "\033[47;31m Delete /upload/admin_admin \033[0m" rm -rf /upload/admin_admin sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/admin_admin \033[0m" sleep 2 svn export http://192.168.1.80/repos/admin_admin /upload/admin_admin --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; mobile_static) echo -e "\033[47;31m Delete /upload/mobile_static \033[0m" rm -rf /upload/mobile_static sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/mobile_static \033[0m" sleep 2 svn export http://192.168.1.80/repos/mobile_static /upload/mobile_static --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; mobile_web) echo -e "\033[47;31m Delete /upload/mobile_web \033[0m" rm -rf /upload/mobile_web sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/mobile_web \033[0m" sleep 2 svn export http://192.168.1.80/repos/mobile_web /upload/mobile_web --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; mobile_api) echo -e "\033[47;31m Delete /upload/mobile_api \033[0m" rm -rf /upload/mobile_api sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/mobile_api \033[0m" sleep 2 svn export http://192.168.1.80/repos/mobile_api /upload/mobile_api --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; public_php) echo -e "\033[47;31m Delete /upload/public_php/trunk \033[0m" rm -rf /upload/public_php/trunk sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/public_php/trunk \033[0m" sleep 2 svn export http://192.168.1.80/repos/public_php/trunk /upload/public_php/trunk --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; interface_package) echo -e "\033[47;31m Delete /upload/interface_package \033[0m" rm -rf /upload/interface_package sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/interface_package \033[0m" sleep 2 svn export http://192.168.1.80/repos/interface_package/trunk /upload/interface_package --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; combination) echo -e "\033[47;31m Delete /upload/combination \033[0m" rm -rf /upload/combination sleep 3 echo "################################" echo -e "\033[47;31m Update /upload/combination \033[0m" sleep 2 svn export http://192.168.1.80/repos/interface_package/combo/trunk /upload/combination --username xxxxxxxx --password xxxxxxxx sleep 3 echo "################################" echo -e "\033[47;31m Update finished! \033[0m" echo "################################" echo "按回车键返回主界面..." read mainmenu2 continue ;; *) echo "----------------------------------" echo "| Warning!!! |" echo "| Please Enter Right Choice! |" echo "----------------------------------" for i in `seq -w 16 -1 1` do echo -ne "\b\b$i"; sleep 1; done clear ;; esac done
本文出自 “bobo365的运维之路” 博客,转载请与作者联系!
生产环境上线脚本(update.sh)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。