Thread:Crazy teitoku/@comment-1915363-20160517151338/@comment-1915363-20160519025937

Here's the shell script I've promised.


 * 1) !/bin/dash
 * 2) IndexedDBbackup v0.66 by Ar-cen-ciel
 * 3) Requires tar and gzip to be installed

DEST=~/KC3Kai-backup/kc3backup.tgz BACKUP=~/KC3Kai-archivebackup USERDIR=~/.config/google-chrome/Default INDEXDB=$USERDIR/IndexedDB/chrome-extension_hkgmldnainaglpjngpajnnjfhpdjkohh_0.indexeddb.leveldb/ LCSTORE=$USERDIR/Local Storage/chrome-extension_hkgmldnainaglpjngpajnnjfhpdjkohh_0.localstorage LCSTOREJRNL=$USERDIR/Local Storage/chrome-extension_hkgmldnainaglpjngpajnnjfhpdjkohh_0.localstorage-journal
 * 1) declare variables

if [ -f kc3backup.current.tgz ]; then rm kc3backup.current.tgz;fi
 * 1) flush existing current temporary archive if exists

tar -czf kc3backup.current.tgz "$INDEXDB" "$LCSTORE" "$LCSTOREJRNL"
 * 1) backup the latest Kc3Kai data.

if [ ! -d "$BACKUP" -a -f kc3backup.03.tgz ];then mkdir "$BACKUP";fi if [ -f kc3backup.03.tgz ];then mv kc3backup.03.tgz "$BACKUP[date -u +"%Y-%m-%d %H:%M"].tgz";fi if [ -f kc3backup.02.tgz ];then mv kc3backup.02.tgz kc3backup.03.tgz;fi if [ -f kc3backup.01.tgz ];then mv kc3backup.03.tgz kc3backup.02.tgz;fi if [ -f "$DEST" ];then mv kc3backup.03.tgz kc3backup.01.tgz;fi if [ -f kc3backup.current.tgz ] then;mv kc3backup.current.tgz "$DEST"
 * 1) conditionals for multi-stage backup

Every time the script is run, it'll archive the current data in tape backup and gzip, then reorder the existing backups before finally relocating the current backup file. I'm pretty sure that I've gotten it mostly right, but my scripting has gotten rusty over a year of disuse and I couldn't really test it by myself.