aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 "$@"