Except CT script introduction (from wiki ):
Except CT is a UNIX automation and testing tool, written by Don libes as an extension to the Tcl scripting language, for interactive applications such as telnet, FTP, passwd, fsck, rlogin, tip, ssh, and others. it uses UNIX pseudo terminals to wrap up subprocesses transparently, allowing the automation of arbitrary applications that are accessed over a terminal. with TK, interactive applications can be wrapped in X11 guis.
It is difficult to script the SSH and SCP, passwd command into the shell script because of these cant get input from Redirect File or something else, while the specified CT is excellent to do it.
The below procedure CT shell to explain how to use procedure CT script:
#! /Usr/bin/CT
Set server [lindex $ argv 0]
Set account [lindex $ argv 1]
Set Password [lindex $ argv 2]
Set destination [lindex $ argv 3]
Set build [lindex $ argv 4]
If {$ Server = "-h" | $ Server = ""}{
Spawn echo "paramter order: SERVER: Account: Password: destinatioin: Build"
Exit
}
Spawn echo "server: $ server"
Spawn echo "account: $ account"
Spawn echo "Password: $ password"
Spawn echo "Destination: $ destination"
Spawn echo "Build: $ build"
Spawn echo "start to run the deployment ============================ ====================================>"
Spawn SSH $ account @ $ server "mkdir-P worker/$ destination; echo 'create dictinary '"
Login CT {* password}
Send "RAAS \ r"
Spawn SCP-r $ build $ account @ $ server: worker/$ destination
Reset CT {* password :}
Send "RAAS \ r"
CT EOF
Spawn SSH $ account @ $ server "Echo 'run2'; CD worker/$ destination; SH pyadpworker. Sh"
Login CT {* password}
Send "RAAS \ r"
CT EOF