cat xxxtyt_stg_update.sh
#!/bin/bash -e
# Author : royoy
# Date : 2019/05
# Desc : update stg for xxxtyt
# Usage : ./script_name branch_name
stg_host="xx.xx.xx.xx"
stg_user="ubuntu"
stg_dir="/home/ubuntu/stg_update"
script_name="${stg_dir}/stg_update.sh"
opt_args="$1"
if [[ -n ${stg_host} && -n ${stg_user} && -n ${stg_dir} && -n ${script_name} && -n ${opt_args} ]]
then
font -f 60 \= -n -d "start to update stg code" -n
ssh ${stg_user}@${stg_host} "${script_name} ${opt_args}" && {
font -d "STG update" -t -green "OK" -reset -n
} || {
font -d "STG update" -t -red "Error" -reset -n
exit 3
}
else
echo "stg_host is null?"
echo "stg_user is null?"
echo "stg_dir is null?"
echo "script_name is null?"
echo "opt_args is null?"
exit 1
fi