summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2023-02-09 08:17:36 -0600
committerzachir <zachir@librem.one>2023-02-09 08:17:36 -0600
commit3c1e920ccd38dc5360809dc171ef525bcc9b9136 (patch)
tree50394e68082f55c87b8bd72e9719f6bc5c970028
parent36647a0992e66718aacfde6f04df1a13cfaaa65b (diff)
add telnet version of ups_ctl
-rwxr-xr-xups_ctl_t.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/ups_ctl_t.sh b/ups_ctl_t.sh
new file mode 100755
index 0000000..89e6c81
--- /dev/null
+++ b/ups_ctl_t.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+/usr/bin/expect -c "spawn telnet $1 5214
+expect \"login: \"
+send \"localadmin\r\"
+expect \"Password: \"
+send \"$3\r\"
+expect -timeout 60 \"localadmin> \"
+send \"device\r\"
+expect \"*)> \"
+send \"load 1\r\"
+expect \"*)> load (1)> \"
+send \"$2\r\"
+expect \"Are you sure? Type \\\"yes\\\" to proceed: \"
+send \"yes\r\"
+expect \"*)> load (1)> \"
+send \"exit\r\"
+expect \"*)> \"
+send \"load 2\r\"
+expect \"*)> load (2)> \"
+send \"$2\r\"
+expect \"Are you sure? Type \\\"yes\\\" to proceed: \"
+send \"yes\r\"
+expect \"*)> load (2)> \"
+send \"exit\r\"
+expect \"*)> \"
+send \"exit\r\"
+expect \"*> \"
+send \"exit\r\"
+expect \"\0\"
+"
+