summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorPaul Wise <pabs@debian.org>2017-04-07 08:19:59 +0800
committerJulian Andres Klode <jak@debian.org>2017-07-12 15:27:02 +0200
commit1d9e29c9e2a5591b42a99a721b901fc003ed9149 (patch)
treeee8687cd713115545da2c0603d761dc3362570ca /debian
parentca90c388045b4498fe32e706bd1bdcf7a6ac8e17 (diff)
Support seconds, minutes, hours and days for APT::Periodic intervals
Diffstat (limited to 'debian')
-rwxr-xr-xdebian/apt.systemd.daily16
1 files changed, 14 insertions, 2 deletions
diff --git a/debian/apt.systemd.daily b/debian/apt.systemd.daily
index efd921ea9..5f868e868 100755
--- a/debian/apt.systemd.daily
+++ b/debian/apt.systemd.daily
@@ -118,8 +118,20 @@ check_stamp()
delta=$(($now-$stamp))
- # interval is in days, convert to sec.
- interval=$(($interval*60*60*24))
+ # Calculate the interval in seconds depending on the unit specified
+ if [ "${interval%s}" != "$interval" ] ; then
+ interval="${interval%s}"
+ elif [ "${interval%m}" != "$interval" ] ; then
+ interval="${interval%m}"
+ interval=$((interval*60))
+ elif [ "${interval%h}" != "$interval" ] ; then
+ interval="${interval%h}"
+ interval=$((interval*60*60))
+ else
+ interval="${interval%d}"
+ interval=$((interval*60*60*24))
+ fi
+
debug_echo "check_stamp: interval=$interval, now=$now, stamp=$stamp, delta=$delta (sec)"
# remove timestamps a day (or more) in the future and force re-check