User Tools

Site Tools


blog:backuppc_script_archive_all_hosts

Backuppc: script archive all hosts

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.

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

Discussion

Enter your comment. Wiki syntax is allowed:
   __  ___  _____ ______  _   __   __ 
  /  |/  / / ___//_  __/ | | / /  / / 
 / /|_/ / / /__   / /    | |/ /  / /__
/_/  /_/  \___/  /_/     |___/  /____/
 
blog/backuppc_script_archive_all_hosts.txt · Last modified: 2017-10-27 20:25 by brb