This commit is contained in:
Cyberes 2024-03-07 15:18:46 -07:00
parent 41f524e259
commit 650d2fbc3d
1 changed files with 5 additions and 8 deletions

View File

@ -1,9 +1,12 @@
#!/usr/bin/env python3
import argparse
import re
import subprocess
import sys
import traceback
from datetime import datetime
import humanfriendly
from dateutil import tz
from checker import nagios
@ -13,17 +16,11 @@ from checker.result import quit_check
sys.path.insert(0, "/usr/lib/python3/dist-packages")
import dbus
import re
import subprocess
from datetime import datetime
import humanfriendly
SYSTEMCTL_TIMERS_RE = re.compile(
r'^(([A-Za-z]*\s[0-9]{4}-[0-9]{2}-[0-9]{2}\s*[0-9]{2}:[0-9]{2}:[0-9]{2}\s[A-Z]*)|n\/a)\s*((([0-9]*[a-z]*\s)*left)|n\/a)\s*(([A-Za-z]*\s[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}\s[A-Z]*)|n\/a)\s*(([0-9A-Za-z\s]*\sago)|n\/a)\s*([A-Za-z\-_]*.timer)\s*(([A-Za-z\-_]*.service)|\s*)')
def get_next_elapse(timer_name):
def get_next_elapse(timer_name) -> tuple[None, Exception] | tuple[dict, None]:
try:
output = subprocess.check_output(["systemctl", "list-timers", "--all"], universal_newlines=True)
lines = output.split('\n')