Permalink
2 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Use separate state directory for timer script
After a backup is completed, update a state directory outside the backup directory with the current symlinks and timestamp files. Update the timer script to use this state directory instead of the backup directory to avoid spinning up the backup drives if no backup is needed. Move the client_lockdir out of the backup directory as well.
- Loading branch information
Showing
with
46 additions
and 1 deletion.
- +2 −0 configs/server/burp.conf
- +5 −1 configs/server/timer_script
- +39 −0 configs/server/update_state_dir
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
echo "Running update_state_dir script: $@" | ||
|
||
preorpost="$1" ; shift | ||
action="$1" ; shift # either "backupphase1" or "backupphase1timed" | ||
client="$1" ; shift | ||
success="$1" ; shift | ||
timer="$1" ; shift | ||
|
||
usage() | ||
{ | ||
echo "usage: $prog post [backupphase1|backupphase1timed] <client> [0|1] [0|1]" 1>&2 | ||
echo "The third argument is whether the backup succeeded (0 for ok)" 1>&2 | ||
echo "The fourth argument is whether the timer script allowed a backup (0 for ok)" 1>&2 | ||
exit 1 | ||
} | ||
|
||
if [ -z "$preorpost" -o -z "$action" -o -z "$client" -o -z "$success" -o -z "timer" ] || [ "$preorpost" != "post" ] | ||
then | ||
usage | ||
fi | ||
|
||
if [ "$action" != "backupphase1" -a "$action" != "backupphase1timed" ] ; then | ||
# It was not a backup that ran. | ||
exit 0 | ||
fi | ||
|
||
if [ "$action" = "backupphase1timed" ] && [ "$timer" != "0" ] ; then | ||
# Server did not allow timed backup to be attempted. | ||
exit 0 | ||
fi | ||
|
||
if [ "$success" != "0" ] ; then | ||
# Backup failed - do not run the offsite backup. | ||
exit 0 | ||
fi | ||
|
||
rsync -av --include '/*/' --include '/*/*/' --include '/*/current' --include '/*/*/timestamp' --include '/*/*/backup' --exclude '*' /media/freeagent/burp/ /var/run/burp/state |
This comment has been minimized.
I've not used Burp,so I could be completely off, but is the state dir supposed to be durable? If so, you might want to move it out of /var/run as some distros mount that in a ramdrive now.
This comment has been minimized.
@jkugler, it's safe for the data to be removed and regenerated upon reboot, but
/var/cache
would probably be more consistent with FHS guidelines. Thanks!