Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -x
- USER=""
- PASSWD=""
- LOG="ssh_conn.log"
- HOSTS="
- ******
- ******
- ******
- ******
- "
- for H in $HOSTS
- do
- echo START SCRIPT: >> $LOG
- date +%x-%R >> $LOG
- COMM="
- #Время ожидание expect
- set timeout 1
- #Соедиение ssh:
- spawn ssh $USER@$H
- expect \"*(yes/no)?*\" {send \"yes\r\"}
- expect \"Password:\"
- send \"$PASSWD\r\"
- expect \"*>\"
- send \"mca-dump"\r\"
- send \"ifconfig" \r\"
- send \"iostat"\r\"
- expect \"*>\"
- send \"exit\r\"
- #Завершение выполнения expect:
- expect eof
- "
- expect -c "$COMM" >> $LOG
- echo ========================================================================= >> $LOG
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement