Code:
host_list="/home/campus27/zwang10/Desktop/cluster/program/hostlist" HOSTS=`cat $host_list` for line in $HOSTS do timeout -5s `ssh $line` done
The above script is all I can do.
host_list="/home/campus27/zwang10/Desktop/cluster/program/hostlist" HOSTS=`cat $host_list` for line in $HOSTS do timeout -5s `ssh $line` done
HOSTS=`cat $host_list` for line in $HOSTS do ssh -o ConnectTimeout=5s $line true >> /dev/null RESULT=$? if [ $RESULT -eq 0 ] then echo $line > succeed.txt else echo $line > fail.txt fi done
ssh: connect to host c28-0112-05.ad.mtu.edu port 22: No route to host
#!/bin/bash for i in `seq -w 1 28` do echo "c15-0330-$i.ad.mtu.edu" # I would like to add a command here to see whether ssh c15-0330-$i.ad.mtu.edu it succeeds or not. And then output a #file which contains the all available host. done for i in `seq -w 1 20` do echo "c28-0112-$i.ad.mtu.edu" done for i in `seq -w 1 20` do echo "c28-112a-$i.ad.mtu.edu" done
host_list=("c15-0330-01.ad.mtu.edu" "c15-0330-02.ad.mtu.edu" "c15-0330-03.ad.mtu.edu" "c15-0330-04.ad.mtu.edu") program=("L_1" "L_4" "L_3" "L_4") subject="The job is finished" START=$(date +"r") address="/home/campus27/zwang10/Desktop/AWRR/program/power/vmodel_1/nprot/K_10" ssh -f "${host_list[0]}" "cd '$address' && nohup Rscript '${program[0]}.R' > '${program[0]}_sh.txt';echo 'The job\n $address\n${program[0]} is finished\nSTART TIME = $START\n' END TIME =`date +"%r"` | mutt zwang10@mtu.edu -s '${host_list[0]} - Job ${program[0]}.R finished' -a '$address/${program[0]}_sh.txt';"
spawn scp $usr@$host:$flnm . expect { -re "(.*)assword:" { send -s "$pswd\r" } }
spawn scp file.txt user@host:file.txt expect { -re "(.*)assword:" { send -s "password\r" } "you sure you want to continue connecting" { send -s "yes\r" exp_continue } }
host_list=("c15-0330-01.ad.mtu.edu" "c15-0330-02.ad.mtu.edu" "c15-0330-03.ad.mtu.edu" "c15-0330-04.ad.mtu.edu") program=("L_1" "L_2" "L_3" "L_4") subject="The job is finished" ssh -f c15-0330-01.ad.mtu.edu 'echo' "the job ${program[0]} is finished" '|' 'mutt "zwang10@mtu.edu" -s' "This is "${program[0]}".R is finished";
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is XX:XX...:XX. Please contact your system administrator. Add correct host key in /Users/user/.ssh/known_hosts to get rid of this message. Offending RSA key in /Users/user/.ssh/known_hosts:5 RSA host key for 192.168.1.3 has changed and you have requested strict checking. Host key verification failed.
df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-root 2.0G 739M 1.2G 39% / tmpfs 24G 0 24G 0% /dev/shm /dev/mapper/mpathap1 194M 65M 120M 36% /boot /dev/mapper/vg00-home 248M 12M 224M 5% /home /dev/mapper/vg00-nsr 248M 11M 226M 5% /nsr /dev/mapper/vg00-opt 3.1G 79M 2.8G 3% /opt /dev/mapper/vg00-itm 434M 11M 402M 3% /opt/IBM/ITM /dev/mapper/vg00-tmp 2.0G 68M 1.9G 4% /tmp /dev/mapper/vg00-usr 2.0G 1.6G 305M 85% /usr /dev/mapper/vg00-usr_local 248M 11M 226M 5% /usr/local /dev/mapper/vg00-var 2.0G 820M 1.1G 43% /var /dev/mapper/vg00-FSImage 917G 3.3G 867G 1% /opt/hadoop-FSImage /dev/mapper/vg00-Zookeeper 917G 200M 870G 1% /opt/hadoop-Zookeeper
df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-root 2.0G 411M 1.5G 22% / tmpfs 36G 0 36G 0% /dev/shm /dev/mapper/mpathap1 194M 67M 118M 37% /boot /dev/mapper/vg00-home 248M 11M 226M 5% /home /dev/mapper/vg00-nsr 248M 11M 226M 5% /nsr /dev/mapper/vg00-opt 3.1G 82M 2.8G 3% /opt /dev/mapper/vg00-itm 434M 11M 402M 3% /opt/IBM/ITM /dev/mapper/vg00-tmp 2.0G 68M 1.9G 4% /tmp /dev/mapper/vg00-usr 2.0G 1.2G 690M 64% /usr /dev/mapper/vg00-usr_local 248M 11M 226M 5% /usr/local /dev/mapper/vg00-var 2.0G 1.5G 392M 80% /var /dev/mapper/vg00-00 559G 33M 559G 1% /opt/hadoop-00 /dev/mapper/vg00-01 559G 33M 559G 1% /opt/hadoop-01 /dev/mapper/vg00-02 559G 33M 559G 1% /opt/hadoop-02 /dev/mapper/vg00-03 559G 33M 559G 1% /opt/hadoop-03 /dev/mapper/vg00-04 559G 33M 559G 1% /opt/hadoop-04 /dev/mapper/vg00-05 559G 33M 559G 1% /opt/hadoop-05 /dev/mapper/vg00-06 559G 33M 559G 1% /opt/hadoop-06 /dev/mapper/vg00-07 559G 33M 559G 1% /opt/hadoop-07
Not enough disk space on host (l1032lab.se.com). A minimum of 1GB is required for "/usr" mount. A minimum of 2GB is required for "/" mount. Not enough disk space on host (l1033lab.se.com). A minimum of 1GB is required for "/usr" mount. A minimum of 2GB is required for "/" mount. Not enough disk space on host (l1034lab.se.com). A minimum of 1GB is required for "/usr" mount. A minimum of 2GB is required for "/" mount. Not enough disk space on host (l1035lab.se.com). A minimum of 1GB is required for "/usr" mount. A minimum of 2GB is required for "/" mount.
/dev/mapper/vg00-FSImage 917G 200M 870G 1% /opt/hadoop-FSImage /dev/mapper/vg00-Zookeeper 917G 6.5G 864G 1% /opt/hadoop-Zookeeper
/dev/mapper/vg00-00 559G 33M 559G 1% /opt/hadoop-00 /dev/mapper/vg00-01 559G 33M 559G 1% /opt/hadoop-01 /dev/mapper/vg00-02 559G 33M 559G 1% /opt/hadoop-02 /dev/mapper/vg00-03 559G 33M 559G 1% /opt/hadoop-03 /dev/mapper/vg00-04 559G 33M 559G 1% /opt/hadoop-04 /dev/mapper/vg00-05 559G 33M 559G 1% /opt/hadoop-05 /dev/mapper/vg00-06 559G 33M 559G 1% /opt/hadoop-06 /dev/mapper/vg00-07 559G 33M 559G 1% /opt/hadoop-07