]> Frank Brehm's Git Trees - my-stuff/backup.git/commitdiff
irgendwas
authorFrank Brehm <frank@brehm-online.com>
Tue, 1 Nov 2011 07:40:17 +0000 (08:40 +0100)
committerFrank Brehm <frank@brehm-online.com>
Tue, 1 Nov 2011 07:40:17 +0000 (08:40 +0100)
bin/backup-functions.rc
bin/backup-pre.sh

index a2a9177782556a0f19594afd322e925c2d0b2723..aeeafe92a2a708653b05c30dbbaf90d26c743491 100644 (file)
@@ -33,7 +33,7 @@ do_backup_fs( ) {
     DO_COMPRESS=$4
 
     EXT=tar
-    TAR_CMD_OPTS="--create --preserve --sparse"
+    TAR_CMD_OPTS="--create --atime-preserve --preserve-permissions --preserve-order --sparse"
     SPLIT_CMD_OPTS="--bytes=${TAR_MAX_VOLUME_SIZE}"
     if [ -n "${DO_COMPRESS}" ] ; then
         EXT=tbz
@@ -99,6 +99,7 @@ do_backup_mysql( ) {
               --lock-tables \
               --quote-names \
               --add-drop-table \
+              --quick \
               ${V_PARAM} --all-databases | bzip2 -c >"${DUMPFILE_ABS}"
 
     echo "   [`date`]: fertig DUMP"
@@ -131,7 +132,12 @@ do_backup_ldap( ) {
 remove_all( ) {
     echo
     echo "Lösche alle lokalen Backups unter ${BACKUP_DIR} ..."
-    find ${BACKUP_DIR} -type f -exec rm -v {} \;
+    #find ${BACKUP_DIR} -type f -exec rm -v {} \;
+    for f in ${BACKUP_DIR}/* ; do
+        if [ -f "${f}" ] ; then
+            rm -v "${f}"
+        fi
+    done
 }
 
 #######################################################################
index c07e69946e2a6c469551cbeed5bffa76d0c35322..7afbc137595957076fe42d54a38b60616f24c82f 100755 (executable)
@@ -50,14 +50,37 @@ for vdir in "${VHOSTS_DIR}"/* ; do
     fi
 done
 
-do_backup_fs "/etc"                "etc"         "${DATUM}" 1
-do_backup_fs "/var/bind"           "bind"        "${DATUM}" 1
-do_backup_fs "/var/lib/portage"    "lib-portage" "${DATUM}" 1
-do_backup_fs "/var/lib/ip*tables"  "iptables"    "${DATUM}" 1
-do_backup_fs "/var/lib/openldap-*" "openldap"    "${DATUM}" 1
-do_backup_fs "/var/lib/svn-repos"  "subversion"  "${DATUM}" 1
-do_backup_fs "/var/log"            "var-log"     "${DATUM}" 1
-do_backup_fs "/root"               "root"        "${DATUM}" 1
+do_backup_fs "/etc"                     "etc"                "${DATUM}" 1
+do_backup_fs "/var/bind"                "var-bind"           "${DATUM}" 1
+do_backup_fs "/var/lib/portage"         "var-lib-portage"    "${DATUM}" 1
+do_backup_fs "/var/lib/git"             "var-lib-git"        "${DATUM}" 1
+do_backup_fs "/var/lib/ip*tables"       "var-lib-iptables"   "${DATUM}" 1
+do_backup_fs "/var/lib/openldap-*"      "var-lib-openldap"   "${DATUM}" 1
+do_backup_fs "/var/lib/layman"          "var-lib-layman"     "${DATUM}" 1
+do_backup_fs "/var/lib/svn-repos"       "var-lib-subversion" "${DATUM}" 1
+do_backup_fs "/var/lib/svn-repos-priv"  "var-lib-svn-priv"   "${DATUM}" 1
+do_backup_fs "/var/log"                 "var-log"            "${DATUM}" 1
+do_backup_fs "/var/spool/cron/crontabs" "var-spool-crontabs" "${DATUM}" 1
+do_backup_fs "/root"                    "root"               "${DATUM}" 1
+
+BOOT_MOUNTED=
+if [ -d /boot/grub ] ; then
+    BOOT_MOUNTED=1
+fi
+
+if [ -z "${BOOT_MOUNTED}" ] ; then
+    mount /boot
+    if [ "$?" != "0" ] ; then
+        echo "Konnte /boot nicht mounten." >&2
+        exit 8
+    fi
+fi
+
+do_backup_fs "/boot" "boot" "${DATUM}" 1
+
+if [ -z "${BOOT_MOUNTED}" ] ; then
+    umount /boot
+fi
 
 for dir in /home/* ; do
 
@@ -114,4 +137,6 @@ echo
 echo "[`date`]: Vorbereitung Backup beendet."
 echo
 
+exit 0
+
 # vim: noai : ts=4 fenc=utf-8 filetype=sh : expandtab