Reverse CT script

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.