diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-08-07 16:25:32 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-08-07 16:26:59 +0200 |
commit | 0b567b9cfeb8b3d022147f7acc00647946746ff9 (patch) | |
tree | 36d41c43c5c587029085eaedc4b37526e61a03e1 /snapshot | |
parent | 14852322c853c0e4e2467bcc3cb45bc32bb8911a (diff) | |
download | bin-0b567b9cfeb8b3d022147f7acc00647946746ff9.tar.xz |
snapshot: Move everything into function
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'snapshot')
-rwxr-xr-x | snapshot | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -6,10 +6,16 @@ create_snapshot() { printf "==> Failet to create a snaphot of %s in %s\n" "$1" "$2" } -SNAPSHOTS=/snapshots -SNAPDIR="$SNAPSHOTS"/"$(date +%Y-%m-%dT%H:%M:%S%z)" -printf "==> Creating snapshots in %s\n" "$SNAPDIR" -sudo mkdir "$SNAPDIR" -create_snapshot / "$SNAPDIR"/root -create_snapshot /home "$SNAPDIR"/home +main() { + local SNAPSHOTS=/snapshots + local SNAPDIR="$SNAPSHOTS"/"$(date +%Y-%m-%dT%H:%M:%S%z)" + printf "==> Creating snapshots in %s\n" "$SNAPDIR" + + sudo mkdir "$SNAPDIR" + create_snapshot / "$SNAPDIR"/root + create_snapshot /home "$SNAPDIR"/home +} + + +main "$@" |