]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-audit
backup-audit: Add some more systemd-related paths to check
[backup-script.git] / bin / backup-audit
index 0dc2995f5925b5da2166067624090a63c0420603..4371bc7ae7ede3e3abb354720edf1684c3521f9e 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # backup-script system for cloning systems using rsync
-# Copyright (c)2008-2016 Alexander Barton, alex@barton.de
+# Copyright (c)2008-2018 Alexander Barton, alex@barton.de
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@ default_target="/var/backups"
 
 # Set shell options.
 shopt -s nullglob
-set -o pipefail
 
 # Search configuration file (last one is used as default!)
 for conf in \
@@ -80,7 +79,7 @@ ListDirectory() {
 
        local exclude
 
-       exclude='total '
+       exclude=' \.$'
        if [[ "$dir_name" == "/" ]]; then
                exclude="$exclude"'| \.stamp$| dev$| etc$| proc$| root$| run$| sys$| tmp$'
                exclude="$exclude"'| data$| net$| srv$'
@@ -88,8 +87,8 @@ ListDirectory() {
        fi
 
        # shellcheck disable=SC2012
-       ls -Al "$base_dir$dir_name" 2>/dev/null \
-               | egrep -v "($exclude)" | awk '!($2="")' | column -t
+       find "$base_dir$dir_name". -maxdepth 1 -printf '%M %10u:%-10g %t %12s  %f\n' 2>/dev/null \
+               | LC_ALL=C sort -k 9 | grep -Ev "($exclude)"
 }
 
 HandleSystem() {
@@ -141,9 +140,8 @@ HandleSystem() {
        # shellcheck source=/dev/null
        source "$latest_d/.stamp"
 
-       if [[ $code -ne 0 && $code -ne 24 ]]; then
-               echo "Last backup generation has errors, skipping system!"
-               echo; return 1
+       if [[ $code -ne 0 ]]; then
+               echo "Warning: Last backup generation had errors, code $code!"
        fi
 
        # Search previous generation without errors
@@ -195,6 +193,7 @@ DiffGenerations() {
                        /etc/aliases \
                        /etc/bash.bashrc \
                        /etc/crontab \
+                       /etc/debian_version \
                        /etc/environment \
                        /etc/fstab \
                        /etc/hostname \
@@ -237,7 +236,15 @@ DiffGenerations() {
                        /etc/cron.hourly/ \
                        /etc/cron.monthly/ \
                        /etc/cron.weekly/ \
+                       /etc/init.d/ \
                        /etc/sudoers.d/ \
+                       /etc/systemd/network/ \
+                       /etc/systemd/system/ \
+                       /etc/systemd/user/ \
+                       /lib/systemd/network/ \
+                       /lib/systemd/system/ \
+                       /usr/lib/systemd/network/ \
+                       /usr/lib/systemd/user/ \
                        /var/log/dumps/ \
                ; do
                        [[ ! -d "${gen1_d}${dir}" ]] && continue