главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shpakovsky <alexey@shpakovsky.ru>2014-03-01 17:37:57 +0100
committerAleksei Shpakovskii <alekseis@opera.com>2014-03-10 19:50:03 +0100
commitb861d25a3a477772d22cc741ddf290d2c1cf20f1 (patch)
treee942b376609d7eb4fe4052334448e5b1044158e5
parenta8b9b0280123066e0acc7879a6db41a413feb8c7 (diff)
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.
-rwxr-xr-xbb.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/bb.sh b/bb.sh
index 0779812..bd4f7b7 100755
--- a/bb.sh
+++ b/bb.sh
@@ -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