Compare commits
4 commits
a7e218c666
...
3e51c23340
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e51c23340 | |||
| 7f7a0a110a | |||
| 9e9950bf8a | |||
| 418beec084 |
3 changed files with 12 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue