bundles/smartd: use systemd-timers
This commit is contained in:
parent
bbfa985e1d
commit
3936e64227
1 changed files with 9 additions and 11 deletions
|
@ -89,21 +89,19 @@ def icinga(metadata):
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'cron/jobs/smartd',
|
'systemd-timers/timers',
|
||||||
)
|
)
|
||||||
def monthly_long_test(metadata):
|
def monthly_long_test(metadata):
|
||||||
lines = set()
|
timers = {}
|
||||||
|
|
||||||
for number, disk in enumerate(sorted(metadata.get('smartd/disks', set()))):
|
for day, disk in enumerate(sorted(metadata.get('smartd/disks', set())), start=1):
|
||||||
lines.add('0 3 {} * * root /usr/sbin/smartctl --test=long {} >/dev/null'.format(
|
timers[f'smartd{disk.replace("/", "-")}'] = {
|
||||||
number+1, # enumerate() starts at 0
|
'command': f'/usr/sbin/smartctl --test=long {disk}',
|
||||||
disk,
|
'when': f'*-*-{day} 03:00:00 UTC',
|
||||||
))
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'cron': {
|
'systemd-timers': {
|
||||||
'jobs': {
|
'timers': timers,
|
||||||
'smartd': '\n'.join(sorted(lines)),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue