Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:backuppc_script_archive_all_hosts [2017-10-27 20:25] (current)
brb
Line 1: Line 1:
 +====== Backuppc: script archive all hosts ======
 +
 +[[http://​backuppc.sourceforge.net/​|BackupPC]] is a very powerful utility for central backup of servers and workstations.
 +
 +Since all backupc will reside on the backup servers disk, it's important to create archives and store them offline and at a remote site. 
 +
 +This script will perform an archive of all hosts using the settings of the ''​archive''​ host in the web interface.
 +
 +<file bash backuppc-archive-all.sh>​
 +#!/bin/bash
 +# Backuppc archive utility
 +# Archives all hosts to the configured archive host
 +# Author: Bernhard Brunner ​
 +# Last modified: 2017-10-27 20:16
 +hostsfile="/​etc/​backuppc/​hosts"​
 +archivestart="/​usr/​share/​backuppc/​bin/​BackupPC_archiveStart"​
 +hosts=""​
 +while read -r line; do
 +    # Skip comments
 +    [[ "​$line"​ =~ ^#.*$ ]] && continue
 +
 +    host=`echo $line | cut -f 1 -d " "`
 +    [ "​$host"​ != ""​ -a "​$host"​ != "​archive"​ -a "​$host"​ != "​host"​ ] && continue
 +
 +    hosts="​$hosts $host"
 +done < "​$hostsfile"​
 +echo Backing up $hosts
 +sudo -u backuppc $archivestart archive backuppc $hosts
 +</​file>​
 +
 +
 +{{tag>}}
 +
 +
 +~~DISCUSSION~~