From 0b567b9cfeb8b3d022147f7acc00647946746ff9 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Fri, 7 Aug 2015 16:25:32 +0200 Subject: snapshot: Move everything into function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- snapshot | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/snapshot b/snapshot index ae6a231..01722aa 100755 --- a/snapshot +++ b/snapshot @@ -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 "$@" -- cgit v1.2.3-54-g00ecf