mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 07:18:09 +02:00
Refactor systemctl services and timers
- Unified service templates into generic systemctl templates - Introduced reusable filter plugins for script path handling - Updated path variables and service/timer definitions - Migrated roles (backup, cleanup, repair, etc.) to use systemctl role - Added sys-daemon role for core systemd cleanup - Simplified timer handling via sys-timer role Note: This is a large refactor and some errors may still exist. Further testing and adjustments will be needed.
This commit is contained in:
@@ -14,7 +14,7 @@ for disc_use_percent in $(df --output=pcent | sed 1d)
|
||||
do
|
||||
disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//")
|
||||
if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ]; then
|
||||
echo "WARNING: $disc_use_percent_number exceeds the limit of {{size_percent_disc_space_warning}}%."
|
||||
echo "WARNING: $disc_use_percent_number exceeds the limit of {{SIZE_PERCENT_DISC_SPACE_WARNING}}%."
|
||||
force_freeing=true
|
||||
fi
|
||||
done
|
||||
@@ -22,9 +22,9 @@ if [ "$force_freeing" = true ]; then
|
||||
echo "cleaning up /tmp" &&
|
||||
find /tmp -type f -atime +10 -delete || exit 1
|
||||
|
||||
{% if backups_folder_path is defined and size_percent_maximum_backup is defined %}
|
||||
{% if BACKUPS_FOLDER_PATH is defined and SIZE_PERCENT_MAXIMUM_BACKUP is defined %}
|
||||
echo "cleaning up backups" &&
|
||||
python {{ PATH_ADMINISTRATOR_SCRIPTS }}sys-ctl-cln-backups/sys-ctl-cln-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} || exit 2
|
||||
python {{ PATH_ADMINISTRATOR_SCRIPTS }}sys-ctl-cln-backups/sys-ctl-cln-backups.py --backups-folder-path {{ BACKUPS_FOLDER_PATH }} --maximum-backup-size-percent {{SIZE_PERCENT_MAXIMUM_BACKUP}} || exit 2
|
||||
{% endif %}
|
||||
|
||||
if pacman -Qs $package > /dev/null ; then
|
@@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=freeing disc space
|
||||
OnFailure=sys-ctl-alm-compose.{{ SOFTWARE_NAME }}@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(' ') }} --ignore {{SYS_SERVICE_GROUP_CLEANUP| join(' ') }} --timeout "{{ SYS_TIMEOUT_BACKUP_SERVICES }}"'
|
||||
ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}sys-ctl-cln-disc-space.sh {{size_percent_cleanup_disc_space}}'
|
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=freeing disc space
|
||||
OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(' ') }} --ignore {{ SYS_SERVICE_GROUP_CLEANUP| join(' ') }} --timeout "{{ SYS_TIMEOUT_BACKUP_SERVICES }}"'
|
||||
ExecStart=/bin/sh -c '/bin/bash {{ systemctl_id | get_service_script_path('sh') }} {{SIZE_PERCENT_CLEANUP_DISC_SPACE}}'
|
Reference in New Issue
Block a user