Created
January 21, 2019 03:49
-
-
Save elebow/8a00aac21140dfacfccef0c3cbb34f18 to your computer and use it in GitHub Desktop.
cron-able Vivaldi session backup script, with rotating history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BACKUP_PARENT=$HOME/.config/vivaldi/viv_session | |
BACKUP_LAST=$(find "$BACKUP_PARENT" -type d | sort -h | tail -n 1) | |
VIVDIR=$HOME/.config/vivaldi/Default | |
diff "$BACKUP_LAST/Current Session" "$VIVDIR/Current Session" > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
#echo "no change" | |
exit 0; | |
fi | |
TMPDIR=$BACKUP_PARENT/$(date "+%Y%m%d_%H%M%S") | |
#echo $TMPDIR | |
mkdir -p "$TMPDIR" | |
cp -p "$VIVDIR"/Last\ * "$VIVDIR"/Current\ * "$TMPDIR" | |
#prune old dirs | |
find "$BACKUP_PARENT" -mindepth 1 -maxdepth 1 -type d | sort -h | head -n -10 | xargs rm -rf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This probably works for any Chrome-based browser.