1
0
mirror of https://github.com/openSUSE/snapper.git synced 2026-02-05 15:46:00 +01:00

- run cleanup service every hour

This commit is contained in:
Arvin Schnell
2024-04-17 15:07:59 +02:00
parent 135680345c
commit 1b02707734
11 changed files with 38 additions and 64 deletions

View File

@@ -31,11 +31,13 @@ UBUNTU_FLAVOURS = \
xUbuntu_22.04 \
xUbuntu_22.10 \
xUbuntu_23.04 \
xUbuntu_23.10
xUbuntu_23.10 \
xUbuntu_24.04
RASPBIAN_FLAVOURS = \
Raspbian_10 \
Raspbian_11
Raspbian_11 \
Raspbian_12
show-debian:
@echo "Debian flavors: $(DEBIAN_FLAVOURS)"

View File

@@ -5,7 +5,7 @@ Documentation=man:snapper(8) man:snapper-configs(5)
[Timer]
OnBootSec=10m
OnUnitActiveSec=1d
OnUnitActiveSec=1h
[Install]
WantedBy=timers.target

View File

@@ -23,4 +23,3 @@ override_dh_auto_install:
dh_auto_install
install -D -m 644 data/sysconfig.snapper $$(pwd)/debian/tmp/etc/sysconfig/snapper
mv $$(pwd)/debian/tmp/etc/cron.hourly/suse.de-snapper $$(pwd)/debian/tmp/etc/cron.hourly/snapper
mv $$(pwd)/debian/tmp/etc/cron.daily/suse.de-snapper $$(pwd)/debian/tmp/etc/cron.daily/snapper

View File

@@ -1,4 +1,3 @@
etc/cron.daily/snapper
etc/cron.hourly/snapper
etc/logrotate.d/snapper
usr/bin/snapper

View File

@@ -18,12 +18,6 @@ version=$2
# will not need this.
if [ "$action" = upgrade ]; then
# move /etc/cron.daily/snapper/suse.de-snapper to the correct location
if [ -e /etc/cron.daily/snapper/suse.de-snapper ]; then
mv /etc/cron.daily/snapper/suse.de-snapper /etc/cron.daily/snapper.cron
rm -rf /etc/cron.daily/snapper
mv /etc/cron.daily/snapper.cron /etc/cron.daily/snapper
fi
# move /etc/cron.hourly/snapper/suse.de-snapper to the correct location
if [ -e /etc/cron.hourly/snapper/suse.de-snapper ]; then
mv /etc/cron.hourly/snapper/suse.de-snapper /etc/cron.hourly/snapper.cron

View File

@@ -111,7 +111,7 @@
<title>Cleanup Algorithms</title>
<para>Snapper provides several algorithms to clean up old snapshots. The
algorithms are executed in a daily cronjob or systemd timer. This can be configured in the
algorithms are executed in an hourly cronjob or systemd timer. This can be configured in the
corresponding configurations files along with parameters for every
algorithm.</para>

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Apr 17 15:00:13 CEST 2024 - aschnell@suse.com
- run cleanup service every hour (gh#openSUSE/snapper#885)
-------------------------------------------------------------------
Tue Apr 16 17:59:58 CEST 2024 - aschnell@suse.com

View File

@@ -14,10 +14,9 @@ pam_snapper_SCRIPTS = \
endif
EXTRA_DIST = snapper-hourly snapper-daily bash-completion.bash zsh-completion.zsh $(pam_snapper_SCRIPTS)
EXTRA_DIST = snapper-hourly bash-completion.bash zsh-completion.zsh $(pam_snapper_SCRIPTS)
install-data-local:
install -D snapper-hourly $(DESTDIR)/etc/cron.hourly/suse.de-snapper
install -D snapper-daily $(DESTDIR)/etc/cron.daily/suse.de-snapper
install -D --mode a+r,u+w bash-completion.bash $(DESTDIR)/usr/share/bash-completion/completions/snapper
install -D --mode a+r,u+w zsh-completion.zsh $(DESTDIR)/usr/share/zsh/site-functions/_snapper

View File

@@ -1,44 +0,0 @@
#!/bin/sh
#
# paranoia settings
#
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
#
# get information from /etc/sysconfig/snapper
#
if [ -f /etc/sysconfig/snapper ] ; then
. /etc/sysconfig/snapper
fi
#
# run snapper for all configs
#
for CONFIG in $SNAPPER_CONFIGS ; do
NUMBER_CLEANUP="no"
TIMELINE_CLEANUP="no"
EMPTY_PRE_POST_CLEANUP="no"
. /etc/snapper/configs/$CONFIG
if [ "$NUMBER_CLEANUP" = "yes" ] ; then
snapper --config=$CONFIG --quiet cleanup number
fi
if [ "$TIMELINE_CLEANUP" = "yes" ] ; then
snapper --config=$CONFIG --quiet cleanup timeline
fi
if [ "$EMPTY_PRE_POST_CLEANUP" = "yes" ] ; then
snapper --config=$CONFIG --quiet cleanup empty-pre-post
fi
done
exit 0

View File

@@ -17,7 +17,7 @@ fi
#
# run snapper for all configs
# run snapper timeline for all configs
#
for CONFIG in $SNAPPER_CONFIGS ; do
@@ -31,4 +31,29 @@ for CONFIG in $SNAPPER_CONFIGS ; do
done
#
# run snapper cleanup for all configs
#
for CONFIG in $SNAPPER_CONFIGS ; do
NUMBER_CLEANUP="no"
TIMELINE_CLEANUP="no"
EMPTY_PRE_POST_CLEANUP="no"
. /etc/snapper/configs/$CONFIG
if [ "$NUMBER_CLEANUP" = "yes" ] ; then
snapper --config=$CONFIG --quiet cleanup number
fi
if [ "$TIMELINE_CLEANUP" = "yes" ] ; then
snapper --config=$CONFIG --quiet cleanup timeline
fi
if [ "$EMPTY_PRE_POST_CLEANUP" = "yes" ] ; then
snapper --config=$CONFIG --quiet cleanup empty-pre-post
fi
done
exit 0

View File

@@ -150,7 +150,6 @@ make %{?_smp_mflags}
%make_install
rm -f "%{buildroot}/%{_libdir}"/*.la "%{buildroot}/%{pam_security_dir}/pam_snapper.la"
rm -f %{buildroot}/etc/cron.hourly/suse.de-snapper
rm -f %{buildroot}/etc/cron.daily/suse.de-snapper
%if 0%{?suse_version}
install -D -m 644 data/sysconfig.snapper "%{buildroot}%{_fillupdir}/sysconfig.snapper"
@@ -186,10 +185,6 @@ if [ -f /etc/cron.hourly/suse.de-snapper ]; then
systemctl preset snapper-timeline.timer || :
systemctl is-enabled -q snapper-timeline.timer && systemctl start snapper-timeline.timer || :
fi
if [ -f /etc/cron.daily/suse.de-snapper ]; then
systemctl preset snapper-cleanup.timer || :
systemctl is-enabled -q snapper-cleanup.timer && systemctl start snapper-cleanup.timer || :
fi
%service_add_post snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif