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(
|
||||
'cron/jobs/smartd',
|
||||
'systemd-timers/timers',
|
||||
)
|
||||
def monthly_long_test(metadata):
|
||||
lines = set()
|
||||
timers = {}
|
||||
|
||||
for number, disk in enumerate(sorted(metadata.get('smartd/disks', set()))):
|
||||
lines.add('0 3 {} * * root /usr/sbin/smartctl --test=long {} >/dev/null'.format(
|
||||
number+1, # enumerate() starts at 0
|
||||
disk,
|
||||
))
|
||||
for day, disk in enumerate(sorted(metadata.get('smartd/disks', set())), start=1):
|
||||
timers[f'smartd{disk.replace("/", "-")}'] = {
|
||||
'command': f'/usr/sbin/smartctl --test=long {disk}',
|
||||
'when': f'*-*-{day} 03:00:00 UTC',
|
||||
}
|
||||
|
||||
return {
|
||||
'cron': {
|
||||
'jobs': {
|
||||
'smartd': '\n'.join(sorted(lines)),
|
||||
},
|
||||
'systemd-timers': {
|
||||
'timers': timers,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue