diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-09-08 12:29:01 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-09-08 12:29:01 +0200 |
commit | e267612dc5095a0aa37b8a7320d8ca071447fd5c (patch) | |
tree | 5523c26ba720111a7400ae0a2c3a76beb84d5bce /snapshot | |
parent | 0b567b9cfeb8b3d022147f7acc00647946746ff9 (diff) | |
download | bin-e267612dc5095a0aa37b8a7320d8ca071447fd5c.tar.xz |
snapshot: Update script based on zorg changes
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'snapshot')
-rwxr-xr-x | snapshot | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,20 +1,21 @@ #!/usr/bin/env bash create_snapshot() { - sudo btrfs subvolume snapshot -r "$1" "$2" && - printf "==> Successfully created a snaphot of %s in %s\n" "$1" "$2" || - printf "==> Failet to create a snaphot of %s in %s\n" "$1" "$2" + local from="$1" + local to="$2"/"$(date +%Y-%m-%dT%H:%M:%S%z)" + sudo mkdir "$to" + sudo btrfs subvolume snapshot -r "$from" "$to" && + printf "==> Successfully created a snaphot of %s in %s\n" "$from" "$to" || + printf "==> Failet to create a snaphot of %s in %s\n" "$from" "$to" } main() { - local SNAPSHOTS=/snapshots - local SNAPDIR="$SNAPSHOTS"/"$(date +%Y-%m-%dT%H:%M:%S%z)" - printf "==> Creating snapshots in %s\n" "$SNAPDIR" + local rootmount=/media/"$SHORTHOST"-ssd-1 + printf "==> Creating snapshots in %s\n" "$rootmount" - sudo mkdir "$SNAPDIR" - create_snapshot / "$SNAPDIR"/root - create_snapshot /home "$SNAPDIR"/home + create_snapshot "$rootmount"/root "$rootmount"/snap-root + create_snapshot "$rootmount"/home "$rootmount"/snap-home } |