소스 검색

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.
Alexey Shpakovsky 11 년 전
부모
커밋
b861d25a3a
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      bb.sh

+ 4 - 0
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