title: 爱流量发包脚本 #标题
tags: work #标签
categories: 工作大杂烩 # 分类
password: jianzhao87.
abstract: 有东西被加密了, 请输入密码查看。
message: 您好, 这里需要密码。
date: 2020-11-19
wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试。
用于保存下业务上发包的脚本。
# Author : lv jian zhao# Describe : 爱流量发包脚本# Date : 2020-07-21set -ersync_source_dir=10.252.201.131::NRPE/lvjianzhao/ailiuliang/backup_dir=/apps/var/backup/cur_date=$(date +%F_%H%M)item=0h2() {printf "\n${underline}${bold}${white}%s${reset}\n" "$@"}USAGE(){echo -e "\033[33m$0 Script usage:-n: Specify the app name to deploy(Such as /apps/var/dfp-flowaccount/ app_name for that:dfp-flowaccount)-h: Output help information\033[0m"}if [[ $1 == '--help' || $1 == '-h' ]]thenUSAGEexit 0fih2 "[Step $item]: Assign a value to a variable..."; let item+=1while getopts ":n:" optname;docase "$optname" in"n")app_name=$OPTARG;;":")echo "This option has no value!";;"*")echo "error message";;"?")echo "Not sure about this option...";;esacdonejar_name=$(basename $(ls /apps/var/${app_name}/*.jar))echo -e "\033[33mapp_name : ${app_name}After successful deployment, be sure to execute the instructions ( ps -ef |grep ${jar_name} | grep -v grep ) to ensure that the new process exists...\033[0m"read -p "Press enter to confirm and continue execution. To terminate, press 'CTRL + C' to terminate the script..."h2 "[Step $item]: backup the original jar package and Synchronous jar package..."; let item+=1if [[ ! -d ${backup_dir} ]];thenmkdir ${tmp_dir} -pficd /apps/var/tar zcf ${backup_dir}${app_name}_${cur_date}.tgz ${app_name}echo -e ""ls -l ${backup_dir}${app_name}_${cur_date}.tgzrsync -az --delete ${rsync_source_dir}${app_name} .chmod 755 -R ${app_name}h2 "[Step $item]: Start the deployment..."; let item+=1supervisorctl restart ${app_name} || trueps -ef | grep ${jar_name} | grep -v grepecho "---- log path: tail -100f /apps/var/${app_name}/logs/catalina.out ------"
