add ssh client close
This commit is contained in:
parent
accb805db6
commit
3269abe626
3
power.py
3
power.py
@ -123,6 +123,7 @@ def shutdown_nas():
|
|||||||
stdin, stdout, stderr = client.exec_command('sudo shutdown')
|
stdin, stdout, stderr = client.exec_command('sudo shutdown')
|
||||||
for line in stdout:
|
for line in stdout:
|
||||||
print(line.strip())
|
print(line.strip())
|
||||||
|
client.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ def pwr_online(battery):
|
|||||||
logger.info(message)
|
logger.info(message)
|
||||||
send_email(f"{ups_id}: Power On Line", message)
|
send_email(f"{ups_id}: Power On Line", message)
|
||||||
send_discord(message)
|
send_discord(message)
|
||||||
if ups_id == "Server" and battery > 90:
|
if ups_id == "Server" and battery > 75:
|
||||||
wake_up(battery)
|
wake_up(battery)
|
||||||
|
|
||||||
def pwr_offline(battery):
|
def pwr_offline(battery):
|
||||||
|
Loading…
Reference in New Issue
Block a user