summaryrefslogtreecommitdiff
path: root/ups_ctl.sh
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2023-01-10 15:29:36 -0600
committerZachIR <zachir@librem.one>2023-01-10 15:29:36 -0600
commitb8e9ce44e45e82f3971b224fc5e7a9beead87533 (patch)
tree4b6863f70e0699dee3cf9fc655a7ae1e9f39ba81 /ups_ctl.sh
parent11af0127f2cec2590ca7e8c304bb499dbb133dbf (diff)
add ups_ctl ssh script
Diffstat (limited to 'ups_ctl.sh')
-rwxr-xr-xups_ctl.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/ups_ctl.sh b/ups_ctl.sh
new file mode 100755
index 0000000..c79648d
--- /dev/null
+++ b/ups_ctl.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+/usr/bin/expect -c "spawn ssh localadmin@$1
+expect \"password:\"
+send \"99999999\r\"
+expect \"localadmin> \"
+send \"device\r\"
+expect \"localadmin> device (VideoRack1)> \"
+send \"load 1\r\"
+expect \"localadmin> device (VideoRack1)> load (1)> \"
+send \"$2\r\"
+expect \"Are you sure? Type \\\"yes\\\" to proceed: \"
+send \"yes\r\"
+expect \"localadmin> device (VideoRack1)> load (1)> \"
+send \"exit\r\"
+expect \"localadmin> device (VideoRack1)> \"
+send \"load 2\r\"
+expect \"localadmin> device (VideoRack1)> load (2)> \"
+send \"$2\r\"
+expect \"Are you sure? Type \\\"yes\\\" to proceed: \"
+send \"yes\r\"
+expect \"localadmin> device (VideoRack1)> load (2)> \"
+send \"exit\r\"
+expect \"localadmin> device (VideoRack1)> \"
+send \"exit\r\"
+expect \"localadmin> \"
+send \"exit\r\"
+expect \"\0\"
+"
+