Bugfix: compatability for older systemd versions

- Older systemd versions do not support RestartPreventExitStatus
- Use exit code 0 to abort, but record code 2 in db as a workaround
This commit is contained in:
Square Root 2021-02-19 10:14:32 +05:30
parent b82979c5e2
commit dec6c81510
2 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,8 @@ fullurl = BASEURL + "/mod/attendance/view.php?id=" + cid
def recordSchedule(db,tries,status):
# TODO: validate response
db.recordSchedule(day, username, cid, tries, status)
if status == 2:
exit(0)
exit(status)

View File

@ -25,7 +25,7 @@ def Schedule(time, user, cid, day, capture_output=True):
'--unit', servicename,
'--on-calendar', time,
'--property', "Restart=on-failure",
'--property', "RestartPreventExitStatus=2",
# '--property', "RestartPreventExitStatus=2",
'--property', propResartSec,
# '--property', propStartLimitIntervalSec,
# '--property', propStartLimitBurst,