Skip to content

Instantly share code, notes, and snippets.

@elebow
Created January 21, 2019 03:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elebow/8a00aac21140dfacfccef0c3cbb34f18 to your computer and use it in GitHub Desktop.
Save elebow/8a00aac21140dfacfccef0c3cbb34f18 to your computer and use it in GitHub Desktop.
cron-able Vivaldi session backup script, with rotating history
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
@elebow
Copy link
Author

elebow commented Jun 13, 2020

This probably works for any Chrome-based browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment