Commit 05bbf386 authored by QA—张 博's avatar QA—张 博

add Git branch

parent 54b6074c
#!/bin/bash
ip=$1
branch_name=$2
date=`date "+%Y-%m-%d %H:%M:%S"`
function Git_branch(){
if [ -z $2 ]; then
echo "查看所有服务分支 $date"
expect -c "
set timeout 10
spawn ssh root@${ip}
expect \"]#\"
send \"for x in `find /home/quant_group/ -maxdepth 2 -name .git`;do cd $(dirname $x);echo $(dirname $x):;git branch | grep '*';done\r\"
set timeout -1
expect \"]#\"
send \"exit\r\"
expect eof;"
else
echo "查看服务$2的分支 $date"
expect -c "
set timeout 10
spawn ssh root@${ip}
expect \"]#\"
send \"cd /home/quant_group/$2\r\"
expect \"]#\"
send \"git branch\r\"
set timeout -1
expect \"]#\"
send \"exit\r\"
expect eof;"
fi
}
Git_branch $1 $2
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment