#!/bin/bash :<<! @date 2018-03-15 @author Jeff.jing @desc Rules of use: 1 The script needs to have execute permission chmod 755 2 The standalone.tar.gz compressed file needs to be passed into the script as a parameter ! #Receive deployment file name standalone_file=$1 if [ ! -f $standalone_file ]; then echo $standalone_file " source file is not found,please check it and try again later !" exit 1 be if [[ ! -s $standalone_file ]];then echo "***********************************************************************" echo "***********************************************************************" echo "target source file is not found ,please check it and try again later !" echo "***********************************************************************" echo "***********************************************************************" exit 1 be if [ ! "${standalone_file##*.}"x = "gz"x ];then echo "***********************************************************************" echo "***********************************************************************" echo "target source file type is not .tar.gz ,please check it and try again later !" echo "***********************************************************************" echo "***********************************************************************" exit 1 be #backup the original project backup_dir=/opt/profile-facade-auto-`date '+%Y%m%d%H%M%S'` echo "***********************************************************************" echo "begin backup profile-facade-auto into "$backup_dir sudo mkdir $backup_dir sudo cp -R /opt/profile-facade-auto/* $backup_dir echo "backup profile-facade-auto into is done" p_id='profile-facade-auto.PID' kill_file="kil-file" touch $p_id touch $kill_file #stop facade-auto process echo "***********************************************************************" echo "begin stop profile-facade-auto java process " ps -ef | grep "/opt/profile-facade-auto/config/" | grep -v grep | awk '{print $2}' > $p_id P_ID=$(head -1 $p_id | awk '{print$1}') echo $P_ID if [ ! -f $P_ID ]; then echo "exit failure process : "$P_ID sudo kill -9 ${P_ID} #>/dev/null 2>&1 Need to determine whether this process really exists! ! ! ! ! echo "profile-facade-auto has been stoped" be sudo rm -rf /opt/profile-facade-auto/ sudo mkdir /opt/profile-facade-auto/ #Unzip the target distribution package echo "***********************************************************************" echo "begin install profile-facade-auto service,please wait a second... " sudo tar -zxvf $standalone_file -C /opt/profile-facade-auto #Online environment configuration file override sudo cp $backup_dir/config/DP-ProfileFacadeAuto-Traffic/config/automotive-schema-extension.json /opt/profile-facade-auto/config/DP-ProfileFacadeAuto-Traffic/config/ sudo cp $backup_dir/config/DP-ProfileFacadeAuto-Traffic/config/profile-facade-auto.config.yml /opt/profile-facade-auto/config/DP-ProfileFacadeAuto-Traffic/config/ sudo cp $backup_dir/config/DP-ProfileFacadeAuto-Traffic/credential/DP-ProfileFacadeAuto-Traffic.yml /opt/profile-facade-auto/config/DP-ProfileFacadeAuto-Traffic/credential/ sudo cp -R $backup_dir/config/foundation-shared/config/* /opt/profile-facade-auto/config/foundation-shared/config/ #Startup project echo "***********************************************************************" echo "starting profile-facade-auto service " sudo /opt/profile-facade-auto/bin/startup.sh echo "profile-facade-auto start up success !" rm $p_id
shell automatically deploys tarballs
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326186333&siteId=291194637
Ranking