diff options
-rwxr-xr-x | proj.py | 57 | ||||
-rwxr-xr-x | ups_ctl.sh | 29 | ||||
-rwxr-xr-x | ups_ctl_15.py3 | 32 | ||||
-rwxr-xr-x | ups_ctl_t.sh | 31 |
4 files changed, 0 insertions, 149 deletions
diff --git a/proj.py b/proj.py deleted file mode 100755 index a85b38c..0000000 --- a/proj.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python3 - -from pysdcp import Projector -from time import sleep -import sys - -PROJ_IP_ADDRESS="10.45.0.100" - -args_len = len(sys.argv) - -first_part = "" -is_second_part = False - -if args_len == 1: - exit() - -pj = Projector(PROJ_IP_ADDRESS) - -for i in range(1, args_len): - if is_second_part == False: - if sys.argv[i] == "power": - is_second_part = True - elif sys.argv[i] == "mute": - is_second_part = True - elif sys.argv[i] == "sleep": - is_second_part = True - else: - print("Command not understood.") - exit() - first_part = sys.argv[i] - else: - is_second_part = False - if first_part == "sleep": - try: - s = float(sys.argv[i]) - except ValueError: - print(f"Value {sys.argv[i]} doesn't look like a number!") - continue - sleep(s) - elif first_part == "power": - if sys.argv[i] == "on": - pj.set_power(True) - elif sys.argv[i] == "off": - pj.set_power(False) - elif sys.argv[i] == "get": - print(pj.get_power()) - else: - print("Command not understood.") - elif first_part == "mute": - if sys.argv[i] == "on": - pj.set_mute(True) - elif sys.argv[i] == "off": - pj.set_mute(False) - elif sys.argv[i] == "get": - print(pj.get_mute()) - else: - print("Command not understood.") diff --git a/ups_ctl.sh b/ups_ctl.sh deleted file mode 100755 index 8495a59..0000000 --- a/ups_ctl.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -/usr/bin/expect -c "spawn ssh localadmin@$1 -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\" -" - diff --git a/ups_ctl_15.py3 b/ups_ctl_15.py3 deleted file mode 100755 index 17dd59c..0000000 --- a/ups_ctl_15.py3 +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if not (len(sys.argv) == 5): - print("Number of arguments doesn't make sense!\n") - exit(1) - -from telnetlib import Telnet as tn - -timeout = 8 - -ups = tn(sys.argv[1],5214,timeout) -ups.read_until(b"login: ",timeout) -ups.write(b"localadmin\r\n") -ups.read_until(b"Password: ",timeout) -ups.write((sys.argv[2] + "\r\n").encode("ascii")) -ups.read_until(b">> ",timeout) -ups.write(b"e\r\n") -ups.read_until(b"$> ",timeout) -if (sys.argv[3] == "on") or (sys.argv[3] == "off"): - ups.write(("loadctl " + sys.argv[3] + " -o 1\r\n").encode("ascii")) - ups.read_until(b'[y/n]? ',timeout) - ups.write(b"y\r\n") - ups.read_until(b'$> ',timeout) -if (sys.argv[4] == "on") or (sys.argv[4] == "off"): - ups.write(("loadctl " + sys.argv[4] + " -o 2\r\n").encode("ascii")) - ups.read_until(b'[y/n]? ',timeout) - ups.write(b"y\r\n") - ups.read_until(b'$> ',timeout) -ups.write(b"exit\r\n") -ups.read_until(b"Farewell, localadmin.\r\r\n") diff --git a/ups_ctl_t.sh b/ups_ctl_t.sh deleted file mode 100755 index 89e6c81..0000000 --- a/ups_ctl_t.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/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\" -" - |