Compare commits

..

6 Commits

5 changed files with 10 additions and 7 deletions

View File

@ -24,7 +24,7 @@ on_calendar_backup_remote_to_local: "*-*-* 21:30:00"
## Schedule for Maintenance Tasks ## Schedule for Maintenance Tasks
on_calendar_heal_docker: "*-*-* {{ hours_server_awake | join(',') }}:30:00" 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_renew_lets_encrypt_certificates: "*-*-* 12,00:30:00"
on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00" on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00"
on_calendar_msi_keyboard_color: "*-*-* *:*:00" on_calendar_msi_keyboard_color: "*-*-* *:*:00"

View File

@ -2,5 +2,4 @@
systemd: systemd:
name: backup-data-to-usb.service name: backup-data-to-usb.service
state: reloaded state: reloaded
enabled: yes
daemon_reload: yes daemon_reload: yes

View File

@ -1,7 +1,6 @@
- name: "reload backup-docker-to-local.service" - name: "reload backup-docker-to-local.service"
systemd: systemd:
name: backup-docker-to-local.service name: backup-docker-to-local.service
enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart backup-docker-to-local.timer" - name: "restart backup-docker-to-local.timer"

View File

@ -1,8 +1,8 @@
- name: "reload backup-remote-to-local service" - name: "reload backup-remote-to-local service"
systemd: systemd:
name: backup-remote-to-local.service name: backup-remote-to-local.service
enabled: yes
daemon_reload: yes daemon_reload: yes
- name: "restart backup-remote-to-local timer" - name: "restart backup-remote-to-local timer"
systemd: systemd:
name: backup-remote-to-local.timer name: backup-remote-to-local.timer

View File

@ -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) attempt = wait_for_all_services_to_stop(filtered_services, max_attempts, attempt, break_time_sec)
print("All required services have stopped.") print("All required services have stopped.")
def defrost(filtered_services): def defrost(filtered_services,timeout_sec):
""" """
Defrost services by starting and enabling their timers. 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}") print(f"Unfreezing: {service}")
if service_file_exists(service, "timer"): if service_file_exists(service, "timer"):
timer_name = f"{service}.timer" timer_name = f"{service}.timer"
@ -135,7 +140,7 @@ def main(services, ignored_services, action, timeout_sec):
freeze(filtered_services, timeout_sec) freeze(filtered_services, timeout_sec)
elif action == 'defrost': elif action == 'defrost':
print("Unfreezing services.") print("Unfreezing services.")
defrost(filtered_services) defrost(filtered_services, timeout_sec)
print("Overview:") print("Overview:")
subprocess.run(['systemctl', 'list-timers']) subprocess.run(['systemctl', 'list-timers'])