1
0
Fork 0
mirror of https://github.com/sbrl/bin.git synced 2018-01-10 21:33:46 +00:00
bin/backup

34 lines
1 KiB
Text
Raw Permalink Normal View History

2016-05-24 18:46:53 +00:00
#!/usr/bin/env bash
if [[ -z "$1" ]]
then
echo Error: Not settings file specified!
2016-12-04 09:56:50 +00:00
echo Settings files are located in ~/.config/backups.
echo To use one, simply specify it\'s name. e.g. \'backup riftgate\' would use the \'~/.config/riftgate.config\' backup configuration file.
2017-01-15 08:58:47 +00:00
echo Backup configuration files detected:
ls ~/.config/backups
2016-05-24 18:46:53 +00:00
exit
fi
2016-12-04 09:56:50 +00:00
CONFIG_FILE=~/.config/backups/$1.config
2016-05-24 18:46:53 +00:00
2016-12-04 09:56:50 +00:00
echo Using config file ${CONFIG_FILE}.
. "${CONFIG_FILE}"
echo "Backing '${SOURCE_DIRECTORY}' up to '${BACKUP_DIRECTORY}'."
2016-05-24 18:46:53 +00:00
if [[ ! -w "${BACKUP_DIRECTORY}" ]]
then
notify-send --icon "deja-dup" "Backup Cancelled" "The target directory is not currently available."
exit
fi
2016-06-03 17:19:06 +00:00
env PASSPHRASE=${PASSWORD} SIGN_PASSPHRASE=${PASSWORD} duplicity --progress --encrypt-sign-key ${ENCRYPTION_KEY} "${SOURCE_DIRECTORY}" "${BACKUP_SOURCE_PREFIX}${BACKUP_DIRECTORY}"
2016-05-24 18:46:53 +00:00
notify-send --icon "deja-dup" "Backup Complete" "Riftgate was backed up to Data Shape successfully."
# Delete old backups
#duplicity remove-all-but-n-full 3 --force ${BACKUP_DIRECTORY}