Skip to content

Instantly share code, notes, and snippets.

@awaxa
Last active December 22, 2015 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awaxa/817a3bc36f5c99caa3c3 to your computer and use it in GitHub Desktop.
Save awaxa/817a3bc36f5c99caa3c3 to your computer and use it in GitHub Desktop.
apc ap7900 outlet control
#!/usr/bin/expect
set timeout 3
spawn telnet pdu
expect "User Name :" { send "apc\r" }
expect "Password :" { send "apc\r" }
# device manager
expect "> " { send "1\r" }
# outlet management
expect "> " { send "2\r" }
# outlet control
expect "> " { send "1\r" }
# outlet number
expect "> " { send "4\r" }
# control outlet
expect "> " { send "1\r" }
# immediate on
expect "> " { send "1\r" }
# control outlet
expect "cancel : " { send "YES\r" }
expect ... { send "\r" }
expect "> " { send \033 }
expect "> " { send \033 }
expect "> " { send \033 }
expect "> " { send \033 }
expect "> " { send \033 }
expect "> " { send "4\r" }
@pgporada
Copy link

Bravo hahahaha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment