Compare commits

..

No commits in common. "e17cb201233d9698241b103c5da39cd8d42b1770" and "a1f6c3ca56028d87d9add8b4fd345a0f8108f335" have entirely different histories.

16 changed files with 104 additions and 222 deletions

View File

@ -1,18 +1,15 @@
# Server Tact Variables # Server Tact Variables
## Ours in which the server is 100% working. Rest of the time is reserved for maintanance
hours_server_awake: "{{ range(9, 24) | list + range(0, 3) | list }}"
## Random delay for systemd timers to avoid peak loads. ## Random delay for systemd timers to avoid peak loads.
randomized_delay_sec: "5min" randomized_delay_sec: "15min"
## Schedule for Health Checks ## Schedule for Health Checks
on_calendar_health_btrfs: "*-*-* 00:00:00" on_calendar_health_btrfs: "*-*-* 00:00:00"
on_calendar_health_journalctl: "*-*-* 00:00:00" on_calendar_health_journalctl: "*-*-* 00:00:00"
on_calendar_health_disc_space: "*-*-* 06,12,18,00:00:00" on_calendar_health_disc_space: "*-*-* 06,12,18,00:00:00"
on_calendar_health_docker_container: "*-*-* {{ hours_server_awake | join(',') }}:00:00" on_calendar_health_docker_container: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:00:00"
on_calendar_health_docker_volumes: "*-*-* {{ hours_server_awake | join(',') }}:15:00" on_calendar_health_docker_volumes: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:15:00"
on_calendar_health_nginx: "*-*-* {{ hours_server_awake | join(',') }}:45:00" on_calendar_health_nginx: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01,02:45:00"
## Schedule for Cleanup Tasks ## Schedule for Cleanup Tasks
on_calendar_cleanup_backups: "*-*-* 06,12,18,00:30:00" on_calendar_cleanup_backups: "*-*-* 06,12,18,00:30:00"
@ -23,8 +20,7 @@ on_calendar_backup_docker_to_local: "*-*-* 03:30:00"
on_calendar_backup_remote_to_local: "*-*-* 21:30:00" 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: "*-*-* 09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00,01:30:00"
on_calendar_defrost: "*-*-* 00:00: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"
@ -51,40 +47,27 @@ execute_updates: true # Executes updates
force_backup_before_update: true # Activates the backup before the update procedure force_backup_before_update: true # Activates the backup before the update procedure
# System maintenance Services # System Maintanance Services
## Timeouts to wait for other services to stop ## Defined Services for Backup Tasks
system_maintenance_timeout_cleanup_services: "15min" system_maintanance_backup_services:
system_maintenance_timeout_backup_services: "1h"
system_maintenance_timeout_heal_docker: "30min"
system_maintenance_timeout_update_docker: "5min"
system_maintenance_timeout_defroster: "10min"
## Services
### Defined Services for Backup Tasks
system_maintenance_backup_services:
- "backup-docker-to-local" - "backup-docker-to-local"
- "backup-remote-to-local" - "backup-remote-to-local"
- "backup-data-to-usb" - "backup-data-to-usb"
### Defined Services for System Cleanup ## Defined Services for System Cleanup
system_maintenance_cleanup_services: system_maintanance_cleanup_services:
- "cleanup-backups" - "cleanup-backups"
- "cleanup-disc-space" - "cleanup-disc-space"
- "cleanup-failed-docker-backups" - "cleanup-failed-docker-backups"
### Freeze services (wait until they are finished to be sure that nobody else is doing stuff in the fridge) ## Services that Manipulate the System
- "system-maintenance-service-freeze" system_maintanance_manipulation_services:
- "system-maintenance-service-defrost"
### Services that Manipulate the System
system_maintenance_manipulation_services:
- "heal-docker" - "heal-docker"
- "update-docker" - "update-docker"
## Total System Maintenance Services ## Total System Maintenance Services
system_maintenance_services: "{{ system_maintenance_backup_services + system_maintenance_cleanup_services + system_maintenance_manipulation_services }}" system_maintenance_services: "{{ system_maintanance_backup_services + system_maintanance_cleanup_services + system_maintanance_manipulation_services }}"
## First default freezer action to apply when freezer service get triggered during play ## First default freezer action to apply when freezer service get triggered during play
system_maintenance_service_freeze_action: 'freeze' # Valid Values: freeze, defrost system_maintenance_service_freeze_action: 'freeze' # Valid Values: freeze, defrost

View File

@ -4,5 +4,6 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_backup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "backup-docker-to-local,backup-remote-to-local,backup-data-to-usb" --max_attempts 600'
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py && systemctl start system-maintenance-service-defrost.service' ExecStart=/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'

View File

@ -4,5 +4,6 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_backup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "backup-docker-to-local,backup-remote-to-local,backup-data-to-usb" --max_attempts 600'
ExecStart=/bin/sh -c '/usr/bin/bash {{docker_backup_remote_to_local_folder}}backups-remote-to-local.sh && systemctl start system-maintenance-service-defrost.service' ExecStart=/usr/bin/bash {{docker_backup_remote_to_local_folder}}backups-remote-to-local.sh
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'

View File

@ -4,5 +4,6 @@ OnFailure=systemd-notifier@%n.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "cleanup-backups") | join(',') }}"'
ExecStart=/bin/sh -c '/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} && systemctl start system-maintenance-service-defrost.service' ExecStart=/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'

View File

@ -4,5 +4,6 @@ OnFailure=systemd-notifier@%n.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "cleanup-disc-space") | join(',') }}"'
ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}} && systemctl start system-maintenance-service-defrost.service' ExecStart=/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'

View File

@ -4,5 +4,6 @@ OnFailure=systemd-notifier@%n.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "cleanup-failed-docker-backups") | join(',') }}"'
ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}} && systemctl start system-maintenance-service-defrost.service' ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}}'
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'

View File

@ -24,6 +24,7 @@
- name: set correct folder permissions - name: set correct folder permissions
command: command:
cmd: "docker run --rm --mount type=volume,src=matrix_data,dst=/data -e SYNAPSE_SERVER_NAME={{domain}} -e SYNAPSE_REPORT_STATS=no --entrypoint /bin/sh matrixdotorg/synapse:latest -c 'chown -vR 991:991 /data'" cmd: "docker run --rm --mount type=volume,src=matrix_data,dst=/data -e SYNAPSE_SERVER_NAME={{domain}} -e SYNAPSE_REPORT_STATS=no --entrypoint /bin/sh matrixdotorg/synapse:latest -c 'chown -vR 991:991 /data'"
chdir: "{{path_docker_compose_instances}}baserow/"
- name: add docker-compose.yml - name: add docker-compose.yml
template: template:

View File

@ -1,6 +1,6 @@
# role docker # role docker
## maintenance ## maintanance
### list unused volumes ### list unused volumes
```bash ```bash

View File

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

View File

@ -4,5 +4,6 @@ OnFailure=systemd-notifier@%n.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} heal-docker --timeout "{{system_maintenance_timeout_heal_docker}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "heal-docker") | join(',') }}"'
ExecStart=/bin/sh -c '/bin/python {{heal_docker}}heal-docker.py && systemctl start system-maintenance-service-defrost.service' ExecStart=/bin/python {{heal_docker}}heal-docker.py
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'

View File

@ -2,151 +2,89 @@ import argparse
import subprocess import subprocess
import time import time
import os import os
from datetime import datetime
def parse_time_to_seconds(time_str):
"""
Convert a time string (e.g., '1h', '30min', '45s') to seconds.
"""
units = {"s": 1, "min": 60, "h": 3600}
if time_str[-3:] in units:
number, unit = time_str[:-3], time_str[-3:]
elif time_str[-2:] in units:
number, unit = time_str[:-2], time_str[-2:]
elif time_str[-1:] in units:
number, unit = time_str[:-1], time_str[-1:]
else:
raise ValueError("Invalid time unit")
return int(number) * units[unit]
def service_file_exists(service_name, service_type="service"): def service_file_exists(service_name, service_type="service"):
""" """Check if a systemd service file exists."""
Check if a systemd service file of a given type exists for a service. # Paths where service files can be stored
"""
path = "/etc/systemd/system/" path = "/etc/systemd/system/"
service_file_name = f"{service_name}.{service_type}" service_file_name = service_name + "." + service_type
full_path = os.path.join(path, service_file_name) full_path = os.path.join(path, service_file_name)
# Debug output for checking the service file existence print(f"Checking {full_path}") # Added debug output
print(f"Checking {full_path}") if os.path.isfile(full_path):
return os.path.isfile(full_path) return True
else:
print(f"File not found.") # Debug output if file is not found
def check_service_active(service_name): def check_service_active(service_name):
""" """Check if a service is active or activating."""
Check if a systemd service is currently active or activating.
"""
result = subprocess.run(['systemctl', 'is-active', service_name], stdout=subprocess.PIPE) result = subprocess.run(['systemctl', 'is-active', service_name], stdout=subprocess.PIPE)
service_status = result.stdout.decode('utf-8').strip() service_status = result.stdout.decode('utf-8').strip()
is_active = service_status in ['active', 'activating'] return service_status in ['active', 'activating']
print(f"Service {service_name} is {'active' if is_active else 'not active'}.")
return is_active
def check_any_service_active(services): def freeze(services_to_wait_for, ignored_services, max_attempts):
""" # Filter services that exist and are not in the ignored list
Check if any service in a given list is active or activating. for service in services_to_wait_for:
""" print(f"\nFreezing: {service}")
return any(check_service_active(service) for service in services) if service in ignored_services:
print(f"{service} will be ignored.")
else:
attempt=0
break_time_sec=5
while check_service_active(service):
attempt += 1
print(f"({attempt}/{max_attempts}) Waiting for {break_time_sec} seconds for {service} to stop...")
time.sleep(break_time_sec)
if attempt > max_attempts:
raise Exception(f"Error: Maximum attempts ({max_attempts}) reached. Exit.")
# Stop and disable the corresponding timer, if it exists
if service_file_exists(service,"timer"):
timer_name = service + ".timer"
subprocess.run(['systemctl', 'stop', timer_name])
subprocess.run(['systemctl', 'disable', timer_name])
print(f"{timer_name} stopped and disabled.")
else:
print(f"Skipped.")
print("\nAll required services have stopped.")
def stop_timer(service): def defrost(services_to_wait_for, ignored_services):
""" for service in services_to_wait_for:
Stop and disable a systemd timer for a service if it exists. print(f"\nUnfreezing: {service}")
""" if service in ignored_services:
if service == "system-maintenance-service-defrost": print(f"{service} will be ignored.")
print(f"Ignoring {service}. It's the initializer of freezer.") elif service_file_exists(service,"timer"):
if service_file_exists(service, "timer"): # Start and enable the corresponding timer, if it exists
timer_name = f"{service}.timer" timer_name = service + ".timer"
subprocess.run(['systemctl', 'stop', timer_name])
subprocess.run(['systemctl', 'disable', timer_name])
print(f"{timer_name} stopped and disabled.")
else:
print("No timer to stop for service.")
def filter_services(services, ignored_services):
"""
Filter out services that are in the ignored_services list from services list.
"""
return [service for service in services if service not in ignored_services]
def stop_all_timers(services):
"""
Stop and disable timers for all services in a given list.
"""
for service in services:
stop_timer(service)
def wait_for_all_services_to_stop(filtered_services, max_attempts, attempt, break_time_sec):
"""
Wait until all services in the list have stopped, with a maximum number of attempts.
"""
for service in filtered_services:
while check_service_active(service):
attempt += 1
if attempt > max_attempts:
raise Exception(f"Maximum attempts ({max_attempts}) reached. Exiting.")
print(f"{datetime.now().isoformat()}#{attempt}/{max_attempts}: Waiting for {break_time_sec} seconds for {service} to stop...")
time.sleep(break_time_sec)
return attempt
def freeze(filtered_services, timeout_sec):
"""
Freeze services by stopping them and their timers, waiting up to a timeout.
"""
break_time_sec = 5
attempt = 0
max_attempts = timeout_sec / break_time_sec
while check_any_service_active(filtered_services):
stop_all_timers(filtered_services)
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):
"""
Defrost services by starting and enabling their timers.
"""
for service in filtered_services:
print(f"Unfreezing: {service}")
if service_file_exists(service, "timer"):
timer_name = f"{service}.timer"
subprocess.run(['systemctl', 'start', timer_name]) subprocess.run(['systemctl', 'start', timer_name])
subprocess.run(['systemctl', 'enable', timer_name]) subprocess.run(['systemctl', 'enable', timer_name])
print(f"{timer_name} started and enabled.") print(f"{timer_name} started and enabled.")
else: else:
print("No timer to activate for service.") print(f"Skipped.")
print("All required services are started.") print("\nAll required services are started.")
def main(services, ignored_services, action, timeout_sec): def main(services_to_wait_for, ignored_services, action, max_attempts):
""" print(f"Services to wait for: {services_to_wait_for}")
Main function to process the command-line arguments and perform actions.
"""
# Ignoring the current running service
running_service=f"system-maintenance-service-{action}"
if running_service not in ignored_services:
ignored_services.append(running_service)
filtered_services = filter_services(services, ignored_services)
print(f"Services to handle: {services}")
print(f"Services to ignore: {ignored_services}") print(f"Services to ignore: {ignored_services}")
print(f"Services filtered: {filtered_services}")
if action == 'freeze': if action == 'freeze':
print("Freezing services.") print("Freezing services.");
freeze(filtered_services, timeout_sec) freeze(services_to_wait_for, ignored_services, max_attempts)
elif action == 'defrost': elif action == 'defrost':
print("Unfreezing services.") print("Unfreezing services.");
defrost(filtered_services) defrost(services_to_wait_for, ignored_services)
print("Overview:") print('\nOverview:')
subprocess.run(['systemctl', 'list-timers']) subprocess.run(['systemctl', 'list-timers'])
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Freezes and defrosts systemd services and timers.') parser = argparse.ArgumentParser(description='freezes and defrost systemctl services and timers')
parser.add_argument('action', choices=['freeze', 'defrost'], help='Action to perform: freeze or defrost services.') parser.add_argument('action', choices=['freeze', 'defrost'], help='Action to perform: freeze or defrost services.')
parser.add_argument('services', nargs='+', help='List of services to apply the action to.') parser.add_argument('services', help='Comma-separated list of services to apply the action to')
parser.add_argument('--ignore', nargs='*', help='List of services to ignore in the action.', default=[]) parser.add_argument('--ignore', help='Comma-separated list of services to ignore in the action', default='')
parser.add_argument('--timeout', help='Timeout for freezing services (e.g., 1h, 30min, 45s).', default='1h') parser.add_argument('--max_attempts', type=int, default=60, help='Maximum number of attempts for freezing services')
args = parser.parse_args() args = parser.parse_args()
services = args.services services_to_wait_for = args.services.split(',')
ignored_services = args.ignore if args.ignore else [] ignored_services = args.ignore.split(',') if args.ignore else []
timeout_seconds = parse_time_to_seconds(args.timeout) max_attempts = args.max_attempts
main(services, ignored_services, args.action, timeout_seconds) main(services_to_wait_for, ignored_services,args.action,max_attempts)

View File

@ -1,16 +0,0 @@
- name: "restart system-maintenance-service-defrost.timer"
systemd:
name: system-maintenance-service-defrost.timer
state: restarted
enabled: yes
daemon_reload: yes
- name: "reload system-maintenance-service-freeze.service"
systemd:
name: system-maintenance-service-freeze.service
daemon_reload: yes
- name: "reload system-maintenance-service-defrost.service"
systemd:
name: system-maintenance-service-defrost.service
daemon_reload: yes

View File

@ -5,14 +5,9 @@
dest: "{{path_system_maintenance_service_freezer_script}}" dest: "{{path_system_maintenance_service_freezer_script}}"
when: run_once_system_maintenance_service_freeze is not defined when: run_once_system_maintenance_service_freeze is not defined
- name: Configure system-maintenance-service for each action - name: run the system_maintenance_service_freezer tasks once
loop: set_fact:
- freeze run_once_system_maintenance_service_freeze: true
- defrost
template:
src: system-maintenance-service-freezer.service.j2
dest: "/etc/systemd/system/system-maintenance-service-{{ item }}.service"
notify: "reload system-maintenance-service-{{ item }}.service"
when: run_once_system_maintenance_service_freeze is not defined when: run_once_system_maintenance_service_freeze is not defined
- name: "restart system-maintenance-service.service" - name: "restart system-maintenance-service.service"
@ -23,22 +18,6 @@
daemon_reload: yes daemon_reload: yes
when: maintenance_service_freeze_action_last is not defined or maintenance_service_freeze_action_last != system_maintenance_service_freeze_action when: maintenance_service_freeze_action_last is not defined or maintenance_service_freeze_action_last != system_maintenance_service_freeze_action
- name: create system-maintenance-service-defrost.timer
template:
src: system-maintenance-service-defrost.timer.j2
dest: "/etc/systemd/system/system-maintenance-service-defrost.timer"
register: system_maintenance_service_defrost_timer
changed_when: system_maintenance_service_defrost_timer.changed or activate_all_timers | bool
notify: restart system-maintenance-service-defrost.timer
when: run_once_system_maintenance_service_freeze is not defined
## Runtime Variable Setting
- name: run the system_maintenance_service_freezer tasks once
set_fact:
run_once_system_maintenance_service_freeze: true
when: run_once_system_maintenance_service_freeze is not defined
- name: "set variable to prevent loading when action status didn't change" - name: "set variable to prevent loading when action status didn't change"
set_fact: set_fact:
maintenance_service_freeze_action_last: "{{system_maintenance_service_freeze_action}}" maintenance_service_freeze_action_last: "{{system_maintenance_service_freeze_action}}"

View File

@ -1,10 +0,0 @@
[Unit]
Description=starts system-maintenance-service-defrost.service
[Timer]
OnCalendar={{on_calendar_defrost}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=false
[Install]
WantedBy=timers.target

View File

@ -4,5 +4,4 @@ OnFailure=systemd-notifier@%n.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} {{ system_maintenance_services | join(' ') }} --timeout "{{system_maintenance_timeout_defroster}}"' ExecStart=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} {{ system_maintenance_services | join(",") }}'
ExecStart=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} {{ system_maintenance_services | join(' ') }}'

View File

@ -5,5 +5,6 @@ OnFailure=systemd-notifier@%n.service
[Service] [Service]
Type=oneshot Type=oneshot
{% if force_backup_before_update | bool %}ExecStartPre=/bin/sh -c 'systemctl start backup-docker-to-local.service'{% endif %} {% if force_backup_before_update | bool %}ExecStartPre=/bin/sh -c 'systemctl start backup-docker-to-local.service'{% endif %}
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services | join(' ') }} update-docker --timeout "{{system_maintenance_timeout_heal_docker}}"' ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | reject('equalto', "update-docker") | join(',') }}"'
ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}} && systemctl start system-maintenance-service-defrost.service' ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}}'
ExecStartPost=/bin/sh -c 'systemctl start system-maintenance-service-defrost.service'