mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
Compare commits
6 Commits
e17cb20123
...
585f3afa08
Author | SHA1 | Date | |
---|---|---|---|
585f3afa08 | |||
4912b39baf | |||
a84168e10f | |||
49b447e026 | |||
26c1b4a30f | |||
60327abe0a |
@ -24,7 +24,7 @@ on_calendar_backup_remote_to_local: "*-*-* 21:30:00"
|
||||
|
||||
## Schedule for Maintenance Tasks
|
||||
on_calendar_heal_docker: "*-*-* {{ hours_server_awake | join(',') }}:30:00"
|
||||
on_calendar_defrost: "*-*-* 00:00:00"
|
||||
on_calendar_defrost: "*-*-* *:00,15,30,45:00"
|
||||
on_calendar_renew_lets_encrypt_certificates: "*-*-* 12,00:30:00"
|
||||
on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00"
|
||||
on_calendar_msi_keyboard_color: "*-*-* *:*:00"
|
||||
|
@ -2,5 +2,4 @@
|
||||
systemd:
|
||||
name: backup-data-to-usb.service
|
||||
state: reloaded
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
@ -1,7 +1,6 @@
|
||||
- name: "reload backup-docker-to-local.service"
|
||||
systemd:
|
||||
name: backup-docker-to-local.service
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "restart backup-docker-to-local.timer"
|
||||
|
@ -1,8 +1,8 @@
|
||||
- name: "reload backup-remote-to-local service"
|
||||
systemd:
|
||||
name: backup-remote-to-local.service
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "restart backup-remote-to-local timer"
|
||||
systemd:
|
||||
name: backup-remote-to-local.timer
|
||||
|
@ -100,11 +100,16 @@ def freeze(filtered_services, timeout_sec):
|
||||
attempt = wait_for_all_services_to_stop(filtered_services, max_attempts, attempt, break_time_sec)
|
||||
print("All required services have stopped.")
|
||||
|
||||
def defrost(filtered_services):
|
||||
def defrost(filtered_services,timeout_sec):
|
||||
"""
|
||||
Defrost services by starting and enabling their timers.
|
||||
"""
|
||||
for service in filtered_services:
|
||||
break_time_sec = 5
|
||||
attempt = 0
|
||||
max_attempts = timeout_sec / break_time_sec
|
||||
wait_for_all_services_to_stop(filtered_services, max_attempts, attempt, break_time_sec)
|
||||
|
||||
for service in filtered_services + [f"system-maintenance-service-{action}"]:
|
||||
print(f"Unfreezing: {service}")
|
||||
if service_file_exists(service, "timer"):
|
||||
timer_name = f"{service}.timer"
|
||||
@ -135,7 +140,7 @@ def main(services, ignored_services, action, timeout_sec):
|
||||
freeze(filtered_services, timeout_sec)
|
||||
elif action == 'defrost':
|
||||
print("Unfreezing services.")
|
||||
defrost(filtered_services)
|
||||
defrost(filtered_services, timeout_sec)
|
||||
print("Overview:")
|
||||
subprocess.run(['systemctl', 'list-timers'])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user