Skip to content

Instantly share code, notes, and snippets.

@badboy
Created January 22, 2013 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badboy/4596749 to your computer and use it in GitHub Desktop.
Save badboy/4596749 to your computer and use it in GitHub Desktop.
/home/badboy/music/
/home/badboy/media/filme/
/home/badboy/media/serien/
#!/bin/bash
MAPPER=/dev/mapper/extern
HDD=/dev/mapper/extern-backup
run() {
echo "$ $@"
$@
}
luksopen() {
run sudo cryptsetup --key-file ~/path/to/your/keyfile -v luksOpen /dev/sdb2 extern
run sudo vgchange -ay extern
}
luksclose() {
run sudo vgchange -an extern
run sudo cryptsetup luksClose extern
}
if grep -q $HDD /etc/mtab; then
run umount $HDD
if grep -q $MAPPER /etc/mtab; then
echo still something left
else
luksclose
fi
else
if sudo cryptsetup status extern | head -1 | grep -q "is inactive"; then
luksopen
fi
run mount $HDD
fi
config_version 1.2
snapshot_root /mnt/backup/backup/
no_create_root 1
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
#cmd_preexec /path/to/preexec/script
#cmd_postexec /path/to/postexec/script
#interval hourly 6
interval daily 7
interval weekly 4
interval monthly 3
verbose 2
loglevel 3
#logfile /var/log/rsnapshot.log
lockfile /tmp/rsnapshot.pid
#rsync_short_args -a
#rsync_long_args --delete --numeric-ids --relative --delete-excluded
du_args -csh
#one_fs 0
# The include and exclude parameters, if enabled, simply get passed directly
# to rsync. If you have multiple include/exclude patterns, put each one on a
# separate line. Please look up the --include and --exclude options in the
# rsync man page for more details on how to specify file name patterns.
#
#include ???
#include ???
#exclude ???
#exclude ???
exclude_file /mnt/backup/backup/exclude
link_dest 1
sync_first 1
#use_lazy_deletes 0
#rsync_numtries 0
###############################
### BACKUP POINTS / SCRIPTS ###
###############################
# LOCALHOST
backup /home/ brain/
backup /etc/ brain/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment