Keep first backup of this day

it holds the version of the blog which was here "today in the morning".

this is useful for those who, like me, first do "bb.sh rebuild" few times
before realizing "oh damn I screwed up everything".

Note: you are not expected to screw up on midnight.
This commit is contained in:
Alexey Shpakovsky 2014-03-01 17:37:57 +01:00 committed by Aleksei Shpakovskii
parent a8b9b02801
commit b861d25a3a
1 changed files with 4 additions and 0 deletions

4
bb.sh
View File

@ -1022,6 +1022,10 @@ do_main() {
tar cfz ".backup.tar.gz" *.html &&
chmod 600 ".backup.tar.gz"
# Keep first backup of this day containing yesterday's version of the blog
[ "$(date -r .yesterday.tar.gz +'%d')" != "$(date +'%d')" ] &&
cp .backup.tar.gz .yesterday.tar.gz &> /dev/null
[[ "$1" == "reset" ]] &&
reset && exit