From 10eceff89a1f39479a047171d510ca8bb49bfac9 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 13 Jun 2014 14:13:16 +0100 Subject: Updated --help and expanded list of excluded things to include common meta-filesystems --- byteback-backup | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'byteback-backup') diff --git a/byteback-backup b/byteback-backup index 9600665..346dd5d 100755 --- a/byteback-backup +++ b/byteback-backup @@ -31,19 +31,23 @@ def help Options: --destination, -d : Backup destination (i.e. user@host:/path) - --source, -s : Source paths (defaults: / and /boot) - --exclude, -x : Exclude paths (defaults: /swap.file, /var/backups/localhost, /var/cache) + --source, -s : Source paths (default: /) + --exclude, -x : Exclude paths (defaults: /swap.file, /var/backups/localhost, /var/cache/apt/archives, /var/lib/php5, /tmp, /var/tmp) --verbose, -v: Show rsync command and progress --retry-number, -r : Number of retries on error (default: 3) --retry-delay, -e : Wait number of seconds between retries (default: 1800) --ssh-key, -k : SSH key for connection (default: /etc/byteback/key) --help, -h: Show this message + +Additional excludes can be specified using /etc/byteback/rsync_filter, which is +an rsync filter file. See the rsync man page for information on how this +works. + EOF remove_lockfile! exit 0 end - opts = GetoptLong.new( [ '--help', '-h', GetoptLong::NO_ARGUMENT ], [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ], @@ -108,7 +112,7 @@ if Dir.exists?(File.dirname(@lockfile)) # check the lockfile is sane exist_pid = File.read(@lockfile).to_i if exist_pid > 1 and exist_pid < (File.read("/proc/sys/kernel/pid_max").to_i) - begin + begin Process.getpgid(exist_pid) # if no exception, process is running, abort error("Process is running (#{exist_pid} from #{@lockfile})! Exiting now.") @@ -157,10 +161,24 @@ end # Validate and normalise excludes # if @excludes.nil? - @excludes = ["/swap.file", "/var/backups/localhost"] - @excludes << "/var/cache/apt/archives" if File.directory?("/var/cache/apt/archives") + @excludes = %w( + /swap.file + /tmp + /var/backups/localhost + /var/cache/apt/archives + /var/lib/php5 + /var/tmp + ).select do |x| + File.exists?(x) + end end + +# +# Always add these filesystems +# +@excludes += %w(/dev /proc /run /sys) + @excludes = @excludes.map do |e| e.gsub(/\/+/,"/") end -- cgit v1.2.1