and I have a script called "calibre-upgrade" that looks like this:
Code:
#!/bin/bash
calibre-debug -c "import urllib as u; from calibre.constants import numeric_version; raise SystemExit(int(numeric_version < (tuple(map(int, u.urlopen('http://calibre-ebook.com/downloads/latest_version').read().split('.'))))))"
UP_TO_DATE=$?
if [ $UP_TO_DATE = 0 ]; then
echo "Calibre is up-to-date"
else
calibre --shutdown-running-calibre
killall calibre-server
sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main()"
fi
Which corresponds to a line in my crontab that looks like this:
Code:
0 6 * * 5 /home/schwartze/bin/calibre-upgrade > /dev/null 2>&1
I then go my merry way in sublime confidence that calibre will always be up-to-date.