From 3c1e920ccd38dc5360809dc171ef525bcc9b9136 Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 9 Feb 2023 08:17:36 -0600 Subject: add telnet version of ups_ctl --- ups_ctl_t.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 ups_ctl_t.sh (limited to 'ups_ctl_t.sh') 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\" +" + -- cgit v1.2.3