summaryrefslogtreecommitdiff
path: root/ups_ctl_t.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ups_ctl_t.sh')
-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\"
+"
+