Scripting commands

Top  Previous  Next

The following commands may be used in a script file when invoking SSCL.

 

connect

disconnect

exec

msg

prompt

promptmask

set

send

sendnowait

sendwait

set debug

set hostname

set logfile

set loginprompt

set password

set passwordprompt

set port

set privatekey

set secure

set shellprompt

set tasktimeout

set timeout

set username

wait

 

connect

Establishes connection with remote server.

disconnect

Disconnects from remote server.

exec "<command> "

Executes command on local machine.

 

<command>

 

valid command to be interpreted by the local operating system.

 

Example

 

exec "dir c:\tmp > c:\tmp\dirout.txt"

msg "<message> "

Sends message to current debugging stream. By default the console is the current debug stream and debugging is enabled.

 

Example

 

msg "connecting to server"

prompt <variablename> "<prompt>"

Prompts user to enter a value to be read from the command line and stores this value in the variable name used in the first argument. The value stored in this variable is then available for use later in the script.

 

Example

 

prompt username "Enter username: "

promptmask <variablename> "<prompt>"

Prompts user to enter a value to be read from the command line and stores this value in the variable name used in the first argument. The value stored in this variable is then available for use later in the script. Value entered is masked with an asterisk.

 

Example

 

promptmask password "Enter password: "

set <variablename> <value>

Creates a user defined variable for use within a script.

 

<variablename>

 

A variable name used to reference the variable. Must begin with a letter, and may be followed by 0 or more letters or digits.

 

<value>

 

The value the variable name represents. Valid values include boolean values of true or false, any valid integer or any quoted string.

 

Example

 

set myNumberVariable 12

 

Example

 

set myBooleanVariable true

 

Example

 

set myStringVariable "testing 1.2.3"

 

Variables created may later be referenced using the ${<variablename>} notation.

 

Example

 

set myNumberVariable 12

 

msg "value of myNumberVariable is: {myNumberVariable}"

send "<command>"

Sends command to server and waits for shell prompt to be returned by server.

 

<command>

 

Any valid command to be interpreted by the server.

 

Example

 

send "ls -al"

sendnowait "<command> "

Sends command to server. Does not wait for shell prompt to be returned by server.

 

<command>

 

Any valid command to be interpreted by the server.

 

Example

 

sendnowait "exit"

sendwait "<command>" "<prompt>"

Sends command to server and waits for specified prompt to be returned by server.

 

<command>

 

Any valid command to be interpreted by the server.

 

<prompt>

 

The shell prompt to be returned by the server after command is executed.

 

Example

 

sendwait "export PS1=\"$\"" "$"

set debug <boolean>

Specifies whether debugging is enabled or disabled. By default debugging is enabled and all debugging information is sent to the console.

 

<boolean>

 

true, false

 

Example

 

set debug false

set hostname "<hostname>"

Specifies the hostname of the remote server.

 

<hostname>

 

a valid quoted hostname or IP address

 

Example

 

set hostname "192.168.10.2"

set logfile "<file>"

Specifies the path of the log file to write debug data to. By default all output is sent to the console.

 

<file>

 

a valid relative or absolute file path on local machine

 

Example

 

set logfile "c:\tmp\log.txt"

set loginprompt "<prompt>"

Specifies the login prompt displayed when trying to login to a Telnet server.

 

<prompt>

 

The telnet server login prompt

 

Example

 

set loginprompt "#"

set password "<password>"

Specifies the password to use when logging into the remote server.

 

<password>

 

a valid quoted password for specified username on remote server

 

Example

 

set password "secret"

set passwordprompt "<prompt>"

Specifies the password prompt displayed when trying to login to a Telnet server.

 

<prompt>

 

The Telnet server password prompt.

 

Example

 

set passwordprompt "Password:"

set port <port>

Specifies the port of the remote server. The default ports for Telnet and SSH protocols are 23 and 22 respectively.

 

<port>

 

A valid integer between 1-65535

 

Example

 

set port 2023

set privatekey "<file>"

Specifies the path of private key file to use when authenticating with SSH server. Valid for use in SSH protocol only.

 

<file>

 

a valid relative or absolute file path on local machine

 

Example

 

set privatekey "c:\ssh\keys\id_dsa"

set secure <boolean>

Specifies that the secure SSH protocol be used. Telnet protocol is used by default. Requires that SSH version 2.0 or above be installed on remote server.

 

<boolean>

 

true, false

 

Example

 

set secure true

set shellprompt "<prompt>"

Sets the shell prompt displayed by server after successful login. Default shell prompt value is "$"

 

<prompt>

 

The servers shell prompt.

 

Example

 

set shellprompt "#"

set tasktimeout <seconds>

Sets the maximum timeout for expected prompt to be returned when sending a command. If timeout is exceeded script will abort. Default value is 120 seconds.

 

<seconds>

 

the maximum number of seconds to wait

 

Example

 

set tasktimeout 30

set timeout <seconds>

Sets the maximum timeout used when establishing a connection. If timeout is exceeded script will abort. Default value is 120 seconds.

 

<seconds>

 

the maximum number of seconds to wait

 

Example

 

set timeout 30

set username "<username>"

Specifies the username to use when logging into the remote server.

 

<username>

 

a valid quoted username for remote server

 

Example

 

set username "jsmith"

wait <seconds>

Pauses execution of script for specified number of seconds.

 

<seconds>

 

the number of seconds to wait

 

Example

 

wait 5





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC