Update btrfs-backup script
This commit is contained in:
parent
47ae1f2930
commit
44f06753fa
3 changed files with 12 additions and 3 deletions
|
@ -122,7 +122,7 @@ if [ -z "$LAST_TRANSFERRED" ]; then
|
||||||
sudo btrfs send "$SNAPSHOT_PATH/$LATEST_SNAPSHOT/snapshot" | \
|
sudo btrfs send "$SNAPSHOT_PATH/$LATEST_SNAPSHOT/snapshot" | \
|
||||||
pv --bytes | \
|
pv --bytes | \
|
||||||
ssh "$REMOTE_HOST" "btrfs receive '$DEST_PATH'" && {
|
ssh "$REMOTE_HOST" "btrfs receive '$DEST_PATH'" && {
|
||||||
sudo echo "$LATEST_SNAPSHOT" > "$STATE_FILE"
|
sudo echo "$LATEST_SNAPSHOT" | sudo tee "$STATE_FILE"
|
||||||
log "Full send completed successfully"
|
log "Full send completed successfully"
|
||||||
} || {
|
} || {
|
||||||
log "ERROR: Full send failed"
|
log "ERROR: Full send failed"
|
||||||
|
@ -135,7 +135,7 @@ else
|
||||||
"$SNAPSHOT_PATH/$LATEST_SNAPSHOT/snapshot" | \
|
"$SNAPSHOT_PATH/$LATEST_SNAPSHOT/snapshot" | \
|
||||||
pv --bytes | \
|
pv --bytes | \
|
||||||
ssh "$REMOTE_HOST" "btrfs receive '$DEST_PATH'" && {
|
ssh "$REMOTE_HOST" "btrfs receive '$DEST_PATH'" && {
|
||||||
sudo echo "$LATEST_SNAPSHOT" > "$STATE_FILE"
|
sudo echo "$LATEST_SNAPSHOT" | sudo tee "$STATE_FILE"
|
||||||
log "Incremental send completed successfully"
|
log "Incremental send completed successfully"
|
||||||
} || {
|
} || {
|
||||||
log "ERROR: Incremental send failed"
|
log "ERROR: Incremental send failed"
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
{
|
{
|
||||||
imports = [ ../../common/services/snapper.nix ];
|
imports = [ ../../common/services/snapper.nix ];
|
||||||
|
|
||||||
|
|
||||||
|
services.cron = {
|
||||||
|
systemCronJobs = [
|
||||||
|
# Back up Local-Storage to NFS Storage
|
||||||
|
"0 9 * * * root rsync -avr /Local-Storage/Data/Docker/ifargle.com/vpn-stack/ /Storage/Data/Docker/ifargle.com/vpn-stack/"
|
||||||
|
"0 0 * * 3 albert sudo btrfs-backup root"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
services.btrfs.autoScrub.enable = true;
|
services.btrfs.autoScrub.enable = true;
|
||||||
services.btrfs.autoScrub.interval = "weekly";
|
services.btrfs.autoScrub.interval = "weekly";
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 26552d8bade6fa39188ebf68e9ffa1a8dcd75108
|
Subproject commit 8ed82c9afaac6359cf4603196f7a5bd4b399a4b5
|
Loading…
Reference in a new issue