Skip to content

Commit

Permalink
Merge pull request #897 from aschnell/master
Browse files Browse the repository at this point in the history
- run cleanup service every hour
  • Loading branch information
aschnell authored Apr 17, 2024
2 parents 901e339 + 1b02707 commit bb7e3c8
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 64 deletions.
6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion data/cleanup.timer
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Documentation=man:snapper(8) man:snapper-configs(5)

[Timer]
OnBootSec=10m
OnUnitActiveSec=1d
OnUnitActiveSec=1h

[Install]
WantedBy=timers.target
Expand Down
1 change: 0 additions & 1 deletion dists/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion dists/debian/snapper.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
etc/cron.daily/snapper
etc/cron.hourly/snapper
etc/logrotate.d/snapper
usr/bin/snapper
Expand Down
6 changes: 0 additions & 6 deletions dists/debian/snapper.preinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/snapper.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
5 changes: 5 additions & 0 deletions package/snapper.changes
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions scripts/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 0 additions & 44 deletions scripts/snapper-daily

This file was deleted.

27 changes: 26 additions & 1 deletion scripts/snapper-hourly
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi


#
# run snapper for all configs
# run snapper timeline for all configs
#
for CONFIG in $SNAPPER_CONFIGS ; do

Expand All @@ -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
5 changes: 0 additions & 5 deletions snapper.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit bb7e3c8

Please sign in to comment.