1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/itenis-itennis-server-tools

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
start.sh 3.6 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
iTenis Отправлено 27.05.2020 10:03 d3f55de
#!/usr/bin/env bash
load_function(){
. config/itennis.conf
. core/log_print.sh
. tools/remote.sh
. tools/check_packages.sh
. tools/base_function.sh
}
batch_exec_cmds(){
CMDS_LIST=/tmp/cmds_list.$$
CONF_LIST=${HOSTS_CONF}
read -p "please input command: "
(
cat << EOF
$REPLY
EOF
) > ${CMDS_LIST}
while true
do
read -p "Please enter whether multiple processes are running backstage[y/n]: "
bg=$REPLY
if [[ $bg = "y" ]] || [[ $bg = "n" ]];then
break
fi
done
remoteScpRemote config/${MAIN_IP_CONFIG} ${CMDS_LIST} ${CMDS_LIST} y
remoteCmd config/${MAIN_IP_CONFIG} "sh ${CMDS_LIST}" $bg
remoteCmd config/${MAIN_IP_CONFIG} "rm -f ${CMDS_LIST}" y
rm /tmp/*.$$
}
batch_exec_scp_remote(){
read -p "Please enter the local path:"
LOCAL_FILE=$REPLY
read -p "Please enter the remote path:"
REMOTE_FILE=$REPLY
while true
do
read -p "Please enter whether multiple processes are running backstage[y/n]: "
bg=$REPLY
if [[ $bg = "y" ]] || [[ $bg = "n" ]];then
break
fi
done
remoteScpRemote config/${MAIN_IP_CONFIG} ${LOCAL_FILE} ${REMOTE_FILE} $bg
}
batch_exec_scp_local(){
read -p "Please enter the remote path:"
REMOTE_FILE=$REPLY
read -p "Please enter the local path:"
LOCAL_FILE=$REPLY
while true
do
read -p "Please enter whether multiple processes are running backstage[y/n]: "
bg=$REPLY
if [[ $bg = "y" ]] || [[ $bg = "n" ]];then
break
fi
done
remoteScpLocal config/${MAIN_IP_CONFIG} ${REMOTE_FILE} ${LOCAL_FILE} $bg
}
display(){
echo "****************************************Please Input************************************"
echo "** [1]:Batch execute commands ** **"
echo "** [2]:Batch copy files to remote ** **"
echo "** [3]:Batch copy files to local ** **"
echo "** [q]:Quit ** **"
echo "***********************@iTennis By xiehuisheng@hotmail.com******************************"
read -p "Please input [1-3,q]: " INPUT
choose_function ${INPUT}
display
}
choose_function(){
case "$1" in
[1] ) log INFO "Select function $1: Batch execute commands" ;batch_exec_cmds;;
[2] ) log INFO "Select function $1: Batch copy files to remote" ;batch_exec_scp_remote;;
[3] ) log INFO "Select function $1: Batch copy files to local" ;batch_exec_scp_local;;
[q] ) log INFO "Program exit" ;exit 0;;
* ) log ERROR "This feature is still under development, please reselect the feature" ;;
esac
}
load_function
check_packages
if [[ ! -n "$1" ]];then
display
elif [[ "$1" = "-f" ]];then
choose_function $2
elif [[ "$1" = "--version" || "$1" = "-v" ]];then
log INFO "iTennis version:${VERSION}"
elif [[ "$1" = "--debug" || "$1" = "-d" ]];then
log WARN "Start program debugging..."
PS4="#[DEBUGGING]:"
set -x
display
else
log ERROR "Your options are wrong, please check if your parameters are correct"
fi
#isNext
#remoteCmd config/${MAIN_IP_CONFIG} "ls -l ~/yc_goods_show" n
#remoteScpRemote config/${MAIN_IP_CONFIG} /Users/apple/Desktop/yc_projects/yc_goods_show/target/goods_show.jar '~/yc_goods_show/' n
#remoteCmd config/${MAIN_IP_CONFIG} "ls -l ~/yc_goods_show" n
#remoteCmd config/${MAIN_IP_CONFIG} 'rm -rf ~/logs' y
#remoteScpLocal config/${MAIN_IP_CONFIG} '~/itennis.log' logs n

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/itenis-itennis-server-tools.git
git@api.gitlife.ru:oschina-mirror/itenis-itennis-server-tools.git
oschina-mirror
itenis-itennis-server-tools
itenis-itennis-server-tools
master