EXPECT | Shutdown MITEL by Serial.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting EXPECT | Shutdown MITEL by Serial.
# 1  
Old 05-23-2016
EXPECT | Shutdown MITEL by Serial.

Hi everybody,

I'm from Spain so excuse my english.


I'm Trying to Shutdown the Mitel 3300 CXI by serial port.

I'm trying to do this with the EXPECT software.

The problem is:

The connection is done.
The "shutdown" is done BUT the Mitel auto-boot if the script does not type "<space><space><space>" to keep the Mitel powered off.

Image

I wrote the next script, of course I tried a lot of variants but I can't send the characters " " (space x3).

#!/usr/bin/expect
spawn screen dev/ttyUSB0
send "appShutdown"
expect "countdown starts..."
send " " (3 spaces but the forum only display 1)
interact


If I can share something more, tell me. Thanks.

Is too important for me...

Thanks for read.

Regards.

Last edited by Jonsaldana; 05-23-2016 at 12:11 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Expect script returning string following a found expect.

I'm fairly new to scripting so this might not be possible. I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version: #show version ... (0 Replies)
Discussion started by: IBGaryA
0 Replies

2. Programming

Calling expect script inside another expect

Hi, Am very new to expect scripting.. Can You please suggest me how to call an expect script inside another expect script.. I tried with spawn /usr/bin/ksh send "expect main.exp\r" expect $root_prompt and spawn /usr/bin/ksh send "main.exp\r" expect $root_prompt Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies

3. Linux

Mitel Standard Linux Installation Problems

I didn't know what sub category to put this under, so I just figured I'd throw it in the main area. I've recently acquired an HP ProLiant120 G6 and am trying to install Mitel's version of Linux onto it. I boot from the cd, and can make it as far as selecting what type of keyboard I have. The... (5 Replies)
Discussion started by: madeang
5 Replies

4. Shell Programming and Scripting

Expect - Comparison of expect value and loop selection

Hello All, I am trying to automate an installation process using expect and sh script. My problem is that during the installation process the expected value can change according to the situation. For Example if this is a first time installation then at step 3 I'll get "Do you want to accept... (0 Replies)
Discussion started by: alokrm
0 Replies

5. UNIX for Dummies Questions & Answers

Script to force Oracle database shutdown when shutdown immediate does not work

I have Oracle 9i R2 on AIX 5.2. My Database is running in shared server mode (MTS). Sometimes when I shutdown the database it shutsdown cleanly in 4-5 mints and sometimes it takes good 15-20 minutes and then I get some ora-600 errors and only way to shutdown is by opening another session and... (7 Replies)
Discussion started by: aixhp
7 Replies

6. Ubuntu

Ubuntu 9.04 Serial application to telnet to serial device

Hello! I am working on an application which reads environmental instruments which have serial ports. The application requires a serial port to be present to talk to the device (i.e. /dev/ttyS0 ). In some instances the environmental devices will be 100's of yards away from the computer, so a... (5 Replies)
Discussion started by: mvona
5 Replies

7. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies

8. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

9. Shell Programming and Scripting

strange expect script behavior, or am i misunderstanding expect scripting?

Hello to all...this is my first post (so please go easy). :) I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
Discussion started by: v1k0d3n
2 Replies

10. Shell Programming and Scripting

Expect and auto expect command

I need to run a remote application(GUI) in a client.i.e on running a script in the client machine i should get the GUI application which is running in the server by providing password through the script.Will expect or autoexpect command suit for this scenario? could anyone help me by posting some... (0 Replies)
Discussion started by: arun_v
0 Replies
Login or Register to Ask a Question
ipptoolfile(5)							    Apple Inc.							    ipptoolfile(5)

NAME
ipptoolfile - ipptool file format DESCRIPTION
The ipptool(1) program accepts free-form plain text files that describe one or more IPP requests. Comments start with the "#" character and continue to the end of the line. Each request is enclosed by curley braces, for example: # This is a comment { # The name of the test NAME "Print PostScript Job" # The request to send OPERATION Print-Job GROUP operation-attributes-tag ATTR charset attributes-charset utf-8 ATTR language attributes-natural-language en ATTR uri printer-uri $uri ATTR name requesting-user-name $user FILE testfile.ps # The response to expect STATUS successful-ok EXPECT attributes-charset OF-TYPE charset EXPECT attributes-natural-language OF-TYPE naturalLanguage EXPECT job-id OF-TYPE integer EXPECT job-uri OF-TYPE uri } { # The name of the test NAME "Get Attributes of PostScript Job" # The request to send OPERATION Get-Job-Attributes GROUP operation-attributes-tag ATTR charset attributes-charset utf-8 ATTR language attributes-natural-language en ATTR uri printer-uri $uri ATTR integer job-id $job-id ATTR name requesting-user-name $user # The response to expect STATUS successful-ok EXPECT attributes-charset OF-TYPE charset EXPECT attributes-natural-language OF-TYPE naturalLanguage EXPECT job-id OF-TYPE integer EXPECT job-uri OF-TYPE uri EXPECT job-state OF-TYPE enum EXPECT job-originating-user-name OF-TYPE name WITH-VALUE "$user" } TOP-LEVEL DIRECTIVES The following directives can be used outside of a test: { test } Defines a test. DEFINE variable-name value Defines the named variable to the given value. This is equivalent to specifying "-d variable-name=value" on the ipptool command-line. DEFINE-DEFAULT variable-name value Defines the named variable to the given value if it does not already have a value. IGNORE-ERRORS yes IGNORE-ERRORS no Specifies whether, by default, ipptool will ignore errors and continue with subsequent tests. INCLUDE "filename" INCLUDE <filename> Includes another test file. The first form includes a file relative to the current test file, while the second form includes a file from the ipptool include directory. INCLUDE-IF-DEFINED name "filename" INCLUDE-IF-DEFINED name <filename> Includes another test file if the named variable is defined. The first form includes a file relative to the current test file, while the second form includes a file from the ipptool include directory. INCLUDE-IF-NOT-DEFINED name "filename" INCLUDE-IF-NOT-DEFINED name <filename> Includes another test file if the named variable is not defined. The first form includes a file relative to the current test file, while the second form includes a file from the ipptool include directory. SKIP-IF-DEFINED variable-name SKIP-IF-NOT-DEFINED variable-name Specifies that the remainder of the test file should be skipped when the variable is or is not defined. TRANSFER auto Specifies that tests will, by default, use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files. TRANSFER chunked Specifies that tests will, by default, use the HTTP/1.1 "Transfer-Encoding: chunked" header. This is the default and is equivalent to specifying "-c" on the ipptool command-line. Support for chunked requests is required for conformance with all versions of IPP. TRANSFER length Specifies that tests will, by default, use the HTTP/1.0 "Content-Length:" header. This is equivalent to specifying "-l" on the ipptool command-line. Support for content length requests is required for conformance with all versions of IPP. VERSION 1.0 VERSION 1.1 VERSION 2.0 VERSION 2.1 VERSION 2.2 Specifies the default IPP version number to use for the tests that follow. TEST DIRECTIVES
The following directives are understood in a test: ATTR tag attribute-name value(s) Adds an attribute to the test request. Values are separated by the comma (",") character - escape commas using the " ATTR collection attribute-name { MEMBER tag member-name value(s) ... } [ ... { ... } ] Adds a collection attribute to the test request. Member attributes follow the same syntax as regular attributes and can themselves be nested collections. Multiple collection values can be supplied as needed. DELAY seconds Specifies a delay before this test will be run. DISPLAY attribute-name Specifies that value of the named attribute should be output as part of the test report. EXPECT attribute-name [ predicate(s) ] EXPECT ?attribute-name predicate(s) EXPECT !attribute-name Specifies that the response must/may/must not include the named attribute. Additional requirements can be added as predicates - see the "EXPECT PREDICATES" section for more information on predicates. FILE filename Specifies a file to include at the end of the request. This is typically used when sending a test print file. GROUP tag Specifies the group tag for subsequent attributes in the request. IGNORE-ERRORS yes IGNORE-ERRORS no Specifies whether ipptool will ignore errors and continue with subsequent tests. NAME "literal string" Specifies the human-readable name of the test. OPERATION operation-code Specifies the operation to be performed. REQUEST-ID number REQUEST-ID random Specifies the request-id value to use in the request, either an integer or the word "random" to use a randomly generated value (the default). RESOURCE path Specifies an alternate resource path that is used for the HTTP POST request. The default is the resource from the URI provided to the ipptool program. SKIP-IF-DEFINED variable-name SKIP-IF-NOT-DEFINED variable-name Specifies that the current test should be skipped when the variable is or is not defined. SKIP-PREVIOUS-ERROR yes SKIP-PREVIOUS-ERROR no Specifies whether ipptool will skip the current test if the previous test resulted in an error/failure. STATUS status-code [ predicate ] Specifies an expected response status-code value. Additional requirements can be added as predicates - see the "STATUS PREDICATES" section for more information on predicates. TRANSFER auto Specifies that this test will use "Transfer-Encoding: chunked" if it has an attached file or "Content-Length:" otherwise. TRANSFER chunked Specifies that this test will use the HTTP/1.1 "Transfer-Encoding: chunked" header. TRANSFER length Specifies that this test will use the HTTP/1.0 "Content-Length:" header. VERSION 1.0 VERSION 1.1 VERSION 2.0 VERSION 2.1 VERSION 2.2 Specifies the IPP version number to use for this test. EXPECT PREDICATES
The following predicates are understood following the EXPECT test directive: COUNT number Requires the EXPECT attribute to have the specified number of values. DEFINE-MATCH variable-name Defines the variable to "1" when the EXPECT condition matches. A side-effect of this predicate is that this EXPECT will never fail a test. DEFINE-NO-MATCH variable-name Defines the variable to "1" when the EXPECT condition does not match. A side- effect of this predicate is that this EXPECT will never fail a test. DEFINE-VALUE variable-name Defines the variable to the value of the attribute when the EXPECT condition matches. A side-effect of this predicate is that this EXPECT will never fail a test. IF-DEFINED variable-name Makes the EXPECT conditions apply only if the specified variable is defined. IF-NOT-DEFINED variable-name Makes the EXPECT conditions apply only if the specified variable is not defined. IN-GROUP tag Requires the EXPECT attribute to be in the specified group tag. OF-TYPE tag[,tag,...] Requires the EXPECT attribute to use the specified value tag(s). REPEAT-MATCH REPEAT-NO-MATCH Specifies that the current test should be repeated when the EXPECT condition matches or does not match. SAME-COUNT-AS attribute-name Requires the EXPECT attribute to have the same number of values as the specified parallel attribute. WITH-VALUE "literal string" Requires at least one value of the EXPECT attribute to match the literal string. Comparisons are case-sensitive. WITH-VALUE "/regular expression/" Requires that all values of the EXPECT attribute match the regular expression, which must conform to the POSIX regular expression syn- tax. Comparisons are case-sensitive. STATUS PREDICATES
The following predicates are understood following the STATUS test directive: IF-DEFINED variable-name Makes the STATUS apply only if the specified variable is defined. IF-NOT-DEFINED variable-name Makes the STATUS apply only if the specified variable is not defined. REPEAT-MATCH REPEAT-NO-MATCH Specifies that the current test should be repeated when the response status-code matches or does not match the value specified by the STATUS directive. OPERATION CODES
Operation codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 2911 and other IPP extension specifications. Here is a complete list: Activate-Printer CUPS-Accept-Jobs CUPS-Add-Modify-Class CUPS-Add-Modify-Printer CUPS-Authenticate-Job CUPS-Delete-Class CUPS-Delete-Printer CUPS-Get-Classes CUPS-Get-Default CUPS-Get-Devices CUPS-Get-Document CUPS-Get-PPD CUPS-Get-PPDs CUPS-Get-Printers CUPS-Move-Job CUPS-Reject-Jobs CUPS-Set-Default Cancel-Current-Job Cancel-Job Cancel-Jobs Cancel-My-Jobs Cancel-Subscription Close-Job Create-Job Create-Job-Subscription Create-Printer-Subscription Deactivate-Printer Disable-Printer Enable-Printer Get-Job-Attributes Get-Jobs Get-Notifications Get-Printer-Attributes Get-Printer-Support-Files Get-Printer-Supported-Values Get-Subscription-Attributes Get-Subscriptions Hold-Job Hold-New-Jobs Pause-Printer Pause-Printer-After-Current-Job Print-Job Print-URI Promote-Job Purge-Jobs Release-Held-New-Jobs Release-Job Renew-Subscription Reprocess-Job Restart-Job Restart-Printer Resubmit-Job Resume-Job Resume-Printer Schedule-Job-After Send-Document Send-Notifications Send-URI Set-Job-Attributes Set-Printer-Attributes Shutdown-Printer Startup-Printer Suspend-Current-Job Validate-Job STATUS CODES
Status codes correspond to the hexadecimal numbers (0xHHHH) and names from RFC 2911 and other IPP extension specifications. Here is a com- plete list: client-error-attributes-not-settable client-error-attributes-or-values-not-supported client-error-bad-request client-error-charset-not-supported client-error-compression-error client-error-compression-not-supported client-error-conflicting-attributes client-error-document-access-error client-error-document-format-error client-error-document-format-not-supported client-error-forbidden client-error-gone client-error-ignored-all-notifications client-error-ignored-all-subscriptions client-error-not-authenticated client-error-not-authorized client-error-not-found client-error-not-possible client-error-print-support-file-not-found client-error-request-entity-too-large client-error-request-value-too-long client-error-timeout client-error-too-many-subscriptions client-error-uri-scheme-not-supported cups-see-other redirection-other-site server-error-busy server-error-device-error server-error-internal-error server-error-job-canceled server-error-multiple-document-jobs-not-supported server-error-not-accepting-jobs server-error-operation-not-supported server-error-printer-is-deactivated server-error-service-unavailable server-error-temporary-error server-error-version-not-supported successful-ok successful-ok-but-cancel-subscription successful-ok-conflicting-attributes successful-ok-events-complete successful-ok-ignored-notifications successful-ok-ignored-or-substituted-attributes successful-ok-ignored-subscriptions successful-ok-too-many-events TAGS
Value and group tags correspond to the names from RFC 2911 and other IPP extension specifications. Here are the group tags: event-notification-attributes-tag job-attributes-tag operation-attributes-tag printer-attributes-tag subscription-attributes-tag unsupported-attributes-tag Here are the value tags: admin-define boolean charset collection dateTime default delete-attribute enum integer keyword mimeMediaType nameWithLanguage nameWithoutLanguage naturalLanguage no-value not-settable octetString rangeOfInteger resolution textWithLanguage textWithoutLanguage unknown unsupported uri uriScheme VARIABLES
The ipptool program maintains a list of variables that can be used in any literal string or attribute value by specifying "$variable-name". Aside from variables defined using the "-d" option or "DEFINE" directive, the following pre-defined variables are available: $$ Inserts a single "$" character. $ENV[name] Inserts the value of the named environment variable, or an empty string if the environment variable is not defined. $filename Inserts the filename provided to ipptool with the "-f" option. $hostname Inserts the hostname from the URI provided to ipptool. $job-id Inserts the last job-id value returned in a test response or 0 if no job-id has been seen. $job-uri Inserts the last job-uri value returned in a test response or an empty string if no job-uri has been seen. $scheme Inserts the scheme from the URI provided to ipptool. $notify-subscription-id Inserts the last notify-subscription-id value returnd in a test response or 0 if no notify-subscription-id has been seen. $port Inserts the port number from the URI provided to ipptool. $resource Inserts the resource path from the URI provided to ipptool. $uri Inserts the URI provided to ipptool. $user Inserts the current user's login name. $username Inserts the username from the URI provided to ipptool, if any. SEE ALSO
ipptool(1), http://localhost:631/help COPYRIGHT
Copyright 2007-2011 by Apple Inc. 28 September 2011 CUPS ipptoolfile(5)