diff --git a/shutdown_ups.py b/shutdown_ups.py index a9a14ca..739d0a6 100644 --- a/shutdown_ups.py +++ b/shutdown_ups.py @@ -40,7 +40,6 @@ def run_command(command): return result.stdout.strip() def main(): - print("Starting UPS monitoring...") while True: 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}') @@ -66,5 +65,6 @@ def main(): time.sleep(interval) if __name__ == "__main__": + print("Starting UPS monitoring...") main() \ No newline at end of file diff --git a/ups_shutdown.service b/ups_shutdown.service index a4b8bfd..2b282c4 100644 --- a/ups_shutdown.service +++ b/ups_shutdown.service @@ -3,7 +3,7 @@ Description=Service to manage UPS shutdown script After=network.target [Service] -ExecStart=/usr/bin/python3 /usr/local/bin/shutdown_ups.py +ExecStart=/usr/local/bin/shutdown_ups.py Restart=always RestartSec=5s