Enable and disable APC interactive loop by Using CT

Source: Internet
Author: User
Tags apc

The company spent thousands of dollars to buy an APC, but APC can only achieve a single switch action, not a loop action. Therefore, it is necessary to enable automatic restart in other ways;

The following is a simple implementation script. It is mainly used to log on to telnet and then perform operations on the APC. In practice, every step of the APC will be prompted, and you can select a number based on the number before the action, therefore, use CT

I originally wanted to use python to write a login under windows.ProgramAs a result, objective CT is not supported in Python in windows!

The following is the implementation process, which is stored here as a backup.

 #! /Usr/bin/login CT-fset I 1 spawn echo "###### running to telnet APC #####" spawn telnetexpect "telnet>" send "O 168.192.0.1 \ r "CT" User Name: "Send" APC \ r "Keep CT" password: "Send" APC \ r "secondary CT"> "send" 1 \ r "secondary CT"> "send" 2 \ r "secondary CT"> "send" 1 \ r "secondary CT"> "Send" 9 \ r "CT"> "send" 1 \ r "while {$ I <5 }{# number of cycles until CT"> "send" 2 \ r "until CT" enter 'yes' to continue or 
  
    to cancel: "Send" Yes \ r "sleep 15 normal CT" press 
   
     to continue... "Send" \ r "CT"> "send" 1 \ r "CT" Enter 'yes' to continue or 
    
      to cancel: "Send" Yes \ r "sleep 15 normal CT" press 
     
       to continue... "Send" \ r "incr I # auto-increment} set timeout-1 specific CT eofexit 
     
    
   
  

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.