]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Backup script for the local machine.
authorwbudic <redacted>
Mon, 4 Mar 2019 01:55:37 +0000 (12:55 +1100)
committerwbudic <redacted>
Mon, 4 Mar 2019 01:55:37 +0000 (12:55 +1100)
backupDBLifeLog.sh [new file with mode: 0755]

diff --git a/backupDBLifeLog.sh b/backupDBLifeLog.sh
new file mode 100755 (executable)
index 0000000..7a675c8
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Following is an hardcoded script that can be used on your local machine
+# to archive from server all the latest SQLite databases on the DB Life Log server.
+#
+# Usefull to cron, to auto backup the databases just in case.
+#
+# Programed by: Will Budic
+# Open Source License -> https://choosealicense.com/licenses/isc/
+DIR="/home/will/Documents/dbLifeLog"
+NOW=`date +%Y%m%d`
+
+if [ ! -d "$DIR" ]; then
+   mkdir $DIR
+fi
+cd $DIR
+
+sftp will@nuc:/home/will/thttpd_dev/dbLifeLog/ <<EOF
+get *.db 
+exit
+EOF
+
+#
+# Archiving optional bellow.
+#
+
+tar -czvf DB_LIFE_LOG_BACKUP_$NOW.tar *.db
+
+#Remove unecessary files.
+find $DIR -type f -name '*.tar' -mtime  1 -exec rm {} \; 
+rm *.db
+
+
+exit