#!/bin/sh
#
# Copyright © 2015 Thomas Schneider <thosch97@gmail.com>
# Distributed under the terms of the ISC license, see LICENSE for details.
#

TIMEU=$(date +%s)
ROOT=/mnt/root
SVN="$1"

TIMEY=$(date -d@"${TIMEU}" +%Y)
TIMEM=$(date -d@"${TIMEU}" +%m)
TIMES=$(date -d@"${TIMEU}" -Im)

cd "${ROOT}"
mkdir -p "${SVN}.snapshots/${TIMEY}/${TIMEM}"
btrfs subvolume snapshot "${SVN}" "${SVN}.snapshots/${TIMEY}/${TIMEM}/${TIMES}"

#!/bin/sh
#
# Copyright © 2015 Thomas Schneider <thosch97@gmail.com>
# Distributed under the terms of the ISC license, see LICENSE for details.
#

TIMEU=$(date +%s)
ROOT=/mnt/root
SVN="$1"

TIMEY=$(date -d@"${TIMEU}" +%Y)
TIMEM=$(date -d@"${TIMEU}" +%m)
TIMED=$(date -d@"${TIMEU}" +%d)
TIMES=$(date -d@"${TIMEU}" -Im)

cd "${ROOT}"
mkdir -p "${SVN}.snapshots/${TIMEY}/${TIMEM}/${TIMED}"
btrfs subvolume snapshot "${SVN}" "${SVN}.snapshots/${TIMEY}/${TIMEM}/${TIMED}/${TIMES}"

Make a subdirectory for each day
Make a subdirectory for each day

Having every snapshot of a month in the same directory would mean at
least 28 (February) directories per month.  This does not change with an
extra directory per day, but what if you have multiple snapshots per
day?

Signed-off-by: Thomas Schneider <6db98389b30108e0095ac10136b50ad76e34ea91@gmail.com>
