progress
This commit is contained in:
parent
0afb8e2db4
commit
f14a5c1637
@ -15,6 +15,8 @@ dist_user=cvttdist
|
|||||||
dist_host="cloud21.cvtt.vpn"
|
dist_host="cloud21.cvtt.vpn"
|
||||||
dist_ssh_port="22"
|
dist_ssh_port="22"
|
||||||
|
|
||||||
|
dist_locations="cloud21.cvtt.vpn:22 homestore.cvtt.vpn:22"
|
||||||
|
|
||||||
interactive=Y
|
interactive=Y
|
||||||
|
|
||||||
# cmdline
|
# cmdline
|
||||||
@ -119,11 +121,16 @@ cmd_arr+=("${Cmd}")
|
|||||||
|
|
||||||
dist_path="${dist_root}/${project}/${release_version}"
|
dist_path="${dist_root}/${project}/${release_version}"
|
||||||
|
|
||||||
Cmd="rsync -avzh"
|
for dist_loc in ${dist_locations}; do
|
||||||
Cmd="${Cmd} --rsync-path=\"mkdir -p ${dist_path} && rsync\""
|
dhp=(${dist_loc//:/ })
|
||||||
Cmd="${Cmd} -e \"ssh -p ${dist_ssh_port}\""
|
dist_host=${dhp[0]}
|
||||||
Cmd="${Cmd} ../${project} ${dist_user}@${dist_host}:${dist_path}/"
|
dist_port=${dhp[1]}
|
||||||
cmd_arr+=("${Cmd}")
|
Cmd="rsync -avzh"
|
||||||
|
Cmd="${Cmd} --rsync-path=\"mkdir -p ${dist_path} && rsync\""
|
||||||
|
Cmd="${Cmd} -e \"ssh -p ${dist_ssh_port}\""
|
||||||
|
Cmd="${Cmd} ../${project} ${dist_user}@${dist_host}:${dist_path}/"
|
||||||
|
cmd_arr+=("${Cmd}")
|
||||||
|
done
|
||||||
|
|
||||||
if [ "${interactive}" == "Y" ]; then
|
if [ "${interactive}" == "Y" ]; then
|
||||||
echo "------------------------------------"
|
echo "------------------------------------"
|
||||||
@ -136,6 +143,7 @@ if [ "${interactive}" == "Y" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
confirm
|
confirm
|
||||||
|
exit
|
||||||
|
|
||||||
for cmd in "${cmd_arr[@]}"
|
for cmd in "${cmd_arr[@]}"
|
||||||
do
|
do
|
||||||
|
|||||||
@ -1,78 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
function usage() {
|
|
||||||
echo "Usage: ${0} <version>"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
}
|
|
||||||
Version=${1}
|
|
||||||
|
|
||||||
if [ "${Version}" == "" ]
|
|
||||||
then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
Project=ops
|
|
||||||
# ----- Settings
|
|
||||||
LocalSoftwareDir=/opt/software/cvtt2
|
|
||||||
|
|
||||||
ProdDir=${HOME}/prod
|
|
||||||
|
|
||||||
Location="${LocalSoftwareDir}/${Project}/${Version}/${Project}"
|
|
||||||
|
|
||||||
|
|
||||||
ReleaseHosts=("cryptovaltrading.com" "cryptoval1.sheynin.home" "cloudstore.cvtt.vpn")
|
|
||||||
ReleasePorts=("1588" "22" "22")
|
|
||||||
ReleaseUsers=("cryptova" "cvtt" "cvtt")
|
|
||||||
ReleaseDir=("/home/cryptova/opt/software/cvtt2" "/opt/software/cvtt2" "/opt/software/cvtt2")
|
|
||||||
|
|
||||||
# ----- Settings
|
|
||||||
|
|
||||||
function rsync_load_version() {
|
|
||||||
for idx in "${!ReleaseHosts[@]}"
|
|
||||||
do
|
|
||||||
host=${ReleaseHosts[${idx}]}
|
|
||||||
port=${ReleasePorts[${idx}]}
|
|
||||||
user=${ReleaseUsers[${idx}]}
|
|
||||||
rel_dir=${ReleaseDir[${idx}]}
|
|
||||||
|
|
||||||
echo "Checking ${user}@${host} for ${rel_dir}/${Project}/${Version} ..."
|
|
||||||
if ssh -q -p ${port} ${user}@${host} "test -d ${rel_dir}/${Project}/${Version}"
|
|
||||||
then
|
|
||||||
echo "Directory found..."
|
|
||||||
rsync_cmd="rsync -ahvv -e \"ssh -p ${port}\""
|
|
||||||
rsync_cmd="${rsync_cmd} ${user}@${host}:${rel_dir}/${Project}/${Version}"
|
|
||||||
rsync_cmd="${rsync_cmd} ${LocalSoftwareDir}/${Project}/"
|
|
||||||
echo ${rsync_cmd}
|
|
||||||
eval ${rsync_cmd}
|
|
||||||
status=$?
|
|
||||||
if [ ${status} -eq 0 ]
|
|
||||||
then
|
|
||||||
echo "Loading successful..."
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Not Found ${rel_dir}/${Project}/${Version} on ${user}@${host}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ ! -d ${LocalSoftwareDir}/${Project} ]] ; then
|
|
||||||
echo ERROR loading software
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# exists and not empty
|
|
||||||
if [[ ! -d "${Location}" ]] ; then
|
|
||||||
rsync_load_version
|
|
||||||
fi
|
|
||||||
|
|
||||||
Cmd="cd ${ProdDir}"
|
|
||||||
|
|
||||||
Cmd="${Cmd} && rm -rf ${Project}"
|
|
||||||
Cmd="${Cmd} && ln -snf ${Location} ${Project}"
|
|
||||||
|
|
||||||
echo ${Cmd}
|
|
||||||
eval ${Cmd}
|
|
||||||
|
|
||||||
echo "Done: $0 $*"
|
|
||||||
Loading…
x
Reference in New Issue
Block a user