aboutsummaryrefslogtreecommitdiff
path: root/thumper.py
diff options
context:
space:
mode:
authorD Delmar Davis <don@suspectdevices.com>2023-08-16 14:48:14 -0700
committerD Delmar Davis <don@suspectdevices.com>2023-08-16 14:48:14 -0700
commite5b9f69ed9cd176b6c0cf73ce3ac8cf63303e4e1 (patch)
tree01fdbdecf3c046b5a803d33c61134181bbe90d5f /thumper.py
parent95d365e6e646f3ed7d96a669772b83e221607b04 (diff)
deploy this
Diffstat (limited to 'thumper.py')
-rwxr-xr-xthumper.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/thumper.py b/thumper.py
new file mode 100755
index 0000000..7dd9af5
--- /dev/null
+++ b/thumper.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import socket
+import subprocess
+
+def isExporting():
+ try:
+ # connect to the host -- tells us if the host is actually
+ # reachable
+ sock = socket.create_connection(("thumper", 9100),timeout=3)
+ if sock is not None:
+ print('dew\'s dat wabbit')
+ sock.close
+ return True
+ except OSError as e:
+ pass
+ return False
+def kickThumper():
+ ret = subprocess.call(["ssh", "root@henri-le-renne", "swctrl poe set auto id 6"]);
+ ret = subprocess.call(["ssh", "root@henri-le-renne", "swctrl poe restart id 6"]);
+
+
+if __name__ == '__main__':
+ if (not isExporting()) :
+ print("Thumpers not talking. Going to kick it")
+ kickThumper()