Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function ab () {
- root=$1
- ser=$2
- return_Status=0
- R_FAIL=1
- restartCmd="/root/run.sh $ser"
- local USER=`whoami`
- expect -c "
- log_user 0
- spawn su - root
- expect {
- timeout { send_user "nFailed to get password prompt after SSH as $USERn"; exit $R_FAIL }
- eof { send_user "nSSH failure for VMn"; exit $R_FAIL }
- "*assword:"
- {
- send "$rootr";
- expect {
- "]#"
- {
- send "$restartCmdr"
- expect {
- "*INFO*" {exit $SUCCESS}
- }
- }
- }
- }"
- }
- ab $1 "$@"
Add Comment
Please, Sign In to add comment