aboutsummaryrefslogtreecommitdiffstats
path: root/snapshot
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-08-07 16:25:32 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2015-08-07 16:26:59 +0200
commit0b567b9cfeb8b3d022147f7acc00647946746ff9 (patch)
tree36d41c43c5c587029085eaedc4b37526e61a03e1 /snapshot
parent14852322c853c0e4e2467bcc3cb45bc32bb8911a (diff)
downloadbin-0b567b9cfeb8b3d022147f7acc00647946746ff9.tar.xz
snapshot: Move everything into function
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'snapshot')
-rwxr-xr-xsnapshot18
1 files 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 "$@"