github.com/halybang/go-ethereum@v1.0.5-0.20180325041310-3b262bc1367c/networkScript/run_script_in_batch.sh (about) 1 #!/bin/sh 2 # set up the logrotate environment to backup wan-chain log data 3 4 # __ ___ _ _ ____ _ _ ____ 5 6 # \ \ / / \ | \ | |/ ___| |__ __ _(_)_ __ | _ \ _____ __ 7 8 # \ \ /\ / / _ \ | \| | | | '_ \ / _` | | '_ \| | | |/ _ \ \ / / 9 10 # \ V V / ___ \| |\ | |___| | | | (_| | | | | | |_| | __/\ V / 11 12 # \_/\_/_/ \_\_| \_|\____|_| |_|\__,_|_|_| |_|____/ \___| \_/ 13 14 # 15 16 #set logrotate at the miner server in batch 17 18 serverUser="ubuntu" 19 serverPwd="" 20 serverIps=( 21 #"127.0.0.1" #the ip server should be included here 22 ) 23 serverKey="/Users/aaron/wanglu/wanchain_key/wanchain_b.pem.pub" 24 script="set_logrotate_env.sh" 25 26 echo "The log rotate script will be run in batch in servers!\n" 27 28 for serverIp in "${serverIps[@]}" 29 do 30 echo "The server " $serverIp " will run the script" 31 32 command=`echo ssh -i $serverKey $serverUser@$serverIp -C \"/bin/bash\"` 33 echo $command 34 $command < $script 35 36 if [ $? -ne 0 ];then 37 echo "The script run with fail" 38 else 39 echo "The script run successfully" 40 fi 41 42 echo "" 43 done