diff --git a/cronjob-dehydrated b/cronjob-dehydrated index 92b623f..ec31e99 100755 --- a/cronjob-dehydrated +++ b/cronjob-dehydrated @@ -1,3 +1,6 @@ #!/bin/bash +# Delay the run for 15 hours (from midnight) and then run at a random time within 3 hours after that. +sleep $(( 54000 + (RANDOM % 10800) )) + /usr/sbin/dehydrated -c >/dev/null diff --git a/cronjob-update-packages-list b/cronjob-update-packages-list index 989cc4e..824965d 100755 --- a/cronjob-update-packages-list +++ b/cronjob-update-packages-list @@ -11,15 +11,19 @@ # Create package list depending on system type. case "$ID" in + 'alpine') + apk list -I | cut -d' ' -f1 | rev | cut -d- -f3- | rev >/etc/pkglist + ;; 'debian'|'ubuntu') - /usr/bin/dpkg-query --show --showformat='${Package}\n' >/etc/pkglist + dpkg-query --show --showformat='${Package}\n' >/etc/pkglist ;; 'slackware') - /usr/sbin/slackpkg -batch=on -default_answer=y generate-template "$(hostname --short)" >/dev/null - [[ ! -e /etc/pkglist ]] && ln -sf "/etc/slackpkg/templates/$(hostname --short).template" /etc/pkglist + slackpkg -batch=on -default_answer=y generate-template "$(hostname --short)" >/dev/null + [[ -L /etc/pkglist ]] && rm -f /etc/pkglist + ls -1 /var/log/packages/ | rev | cut -d- -f4- | rev >/etc/pkglist ;; 'void') - /usr/sbin/xbps-query -l | awk '{ print $2 }' | rev | cut -d- -f2- | rev >/etc/pkglist + xbps-query -l | awk '{ print $2 }' | rev | cut -d- -f2- | rev >/etc/pkglist ;; *) printf "%s: %s\\n" "${BASH_SOURCE[0]}" "Unsupported system." >&2 diff --git a/do-backup b/do-backup index dd3f0d4..0a8e35f 100755 --- a/do-backup +++ b/do-backup @@ -130,7 +130,7 @@ mountpoint "$BACKUP_MOUNTPOINT/" >/dev/null 2>&1 || { } # Do the backup. -rsync "${RSYNC_OPTIONS[@]}" "${RSYNC_OPTIONS_VERBOSE[@]}" "${RSYNC_FILTER[@]}" "$RSYNC_SOURCE" "$BACKUP_DESTDIR" >"$RSYNC_LOG" 2>&1 +ionice -c Idle nice -n 19 rsync "${RSYNC_OPTIONS[@]}" "${RSYNC_OPTIONS_VERBOSE[@]}" "${RSYNC_FILTER[@]}" "$RSYNC_SOURCE" "$BACKUP_DESTDIR" >"$RSYNC_LOG" 2>&1 ERR="$?" # Send a notification and mail a log if there were errors.