This commit is contained in:
vvzvlad 2024-08-13 04:46:18 +03:00
parent 887dd4b7b0
commit d6cdee6fdb
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,6 @@ def run_command(command):
return result.stdout.strip() return result.stdout.strip()
def main(): def main():
print("Starting UPS monitoring...")
while True: while True:
oid_on_battery_time = "1.3.6.1.4.1.318.1.1.1.2.2.3.0" oid_on_battery_time = "1.3.6.1.4.1.318.1.1.1.2.2.3.0"
result = run_command(f'/usr/bin/snmpget -v2c -O v -O q -c public {ups_ip} {oid_on_battery_time}') result = run_command(f'/usr/bin/snmpget -v2c -O v -O q -c public {ups_ip} {oid_on_battery_time}')
@ -66,5 +65,6 @@ def main():
time.sleep(interval) time.sleep(interval)
if __name__ == "__main__": if __name__ == "__main__":
print("Starting UPS monitoring...")
main() main()

View File

@ -3,7 +3,7 @@ Description=Service to manage UPS shutdown script
After=network.target After=network.target
[Service] [Service]
ExecStart=/usr/bin/python3 /usr/local/bin/shutdown_ups.py ExecStart=/usr/local/bin/shutdown_ups.py
Restart=always Restart=always
RestartSec=5s RestartSec=5s