-
Nigel Kukard authoredNigel Kukard authored
dbackup 43.25 KiB
#!/usr/bin/perl -w
# Copyright (c) 2010-2014, AllWorldIT
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Author: Nigel Kukard <nkukard@lbsd.net>
# TODO:
# - USE incremental backups!!!! fucking awesome
#
# - Read in defaultSystemExcl extras from /proc/mounts
# - proc, nfs, nfs4, fusectl fuse.glusterfs, sysfs, tmpfs, devtmpfs, devpts
#
use strict;
use Compress::Zlib;
use Config::IniFiles;
use Cwd;
use Fcntl qw (:mode);
use File::Find;
use File::Path qw( rmtree mkpath );
use File::Spec;
use Getopt::Long;
use POSIX qw (strftime lchown);
use Data::Dumper;
use MIME::Base64;
my $VERSION = "0.0.21";
# System dirs we don't care about
my @defaultSystemExcl = ("/dev","/run","/proc","/sys","/tmp","/var/tmp","/misc","/media","/mnt");
# These should be backed up separately
my @defaultDataExcl = (
# We cannot backup the DB reliably by just copying files
"/var/lib/mysql","/var/lib/pgsql",
# Exclude amavis working files
"/var/amavis/tmp/",
"/var/lib/amavis/tmp/",
"/var/spool/amavis/virusmails/",
"/var/spool/mailman/retry",
# Exclude postfix queues
"/var/spool/postfix/active",
"/var/spool/postfix/defer",
"/var/spool/postfix/deferred",
"/var/spool/postfix/public",
"/var/spool/postfix/private",
# Exclude squid cache
"/var/spool/squid",
# Yum cache
"/var/cache/yum",
# Apt cache
"/var/cache/apt/archives",