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