To backup and synchronize directories with redondancy on multiple support type (nas,computers,usb,cloud) by the most automated way. Push or pull with rsync.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
978 B

#!/bin/bash
backupdirectory=/datas/P1/BOOKMARKS
bookmarksexportdir=/datas/git/bookmarksexport
export_bookmark()
{
echo "export ${browser}"
browser=$1
lastfile=$(find ${backupdirectory} -name "2[0-9]*_${browser}_bookmarks.html" -print |sort -n | tail -n 1)
lastfilechecksum=$(sha512sum "${lastfile}" |cut -d' ' -f 1)
python3 ${bookmarksexportdir}/bookmark_exporter.py --browser "${browser}" --formats html --output /tmp --prefix bookmark
lastexport=$(find /tmp -name "bookmark_2[0-9_]*" -print 2>/dev/null |sort -n |tail -n 1)
lastexportchecksum=$(sha512sum "${lastexport}" |cut -d' ' -f 1)
echo "compare ${lastexportchecksum} == ${lastfilechecksum}"
if [ "${lastexportchecksum}" == "${lastfilechecksum}" ]
then
echo "${browser} bookmarks not modified"
else
echo mv -i "${lastexport}" ${backupdirectory}/"$(date +%Y%m%d%H%M%S)_${browser}_bookmarks.html"
fi
}
for browser in Firefox Chromium Chrome
do
export_bookmark ${browser}
sleep 3
done