Created
February 6, 2014 00:49
-
-
Save leblanc-simon/8836446 to your computer and use it in GitHub Desktop.
Backup monthly the last BackupPC dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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