Skip to content

Instantly share code, notes, and snippets.

@leblanc-simon
Created February 6, 2014 00:49
Show Gist options
  • Save leblanc-simon/8836446 to your computer and use it in GitHub Desktop.
Save leblanc-simon/8836446 to your computer and use it in GitHub Desktop.
Backup monthly the last BackupPC dump
#!/bin/bash
hosts="host1 host2 host3"
shares="home etc root"
base_path="/home/backup/"
month=`date +%m`
command_tar='sudo -u backuppc /usr/share/backuppc/bin/BackupPC_tarCreate -h %host% -n -1 -s /%share% . > '
for host in ${hosts}; do
for share in ${shares}; do
command=`echo "${command_tar}" | sed "s/%host%/${host}/g" | sed "s/%share%/${share}/g"`
file="${base_path}${host}_${share}_${month}.tar"
echo "${command}${file}"
done
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment