Created
September 27, 2011 09:40
-
-
Save czj/1244701 to your computer and use it in GitHub Desktop.
SABnzdb+ auto-update script
This file contains 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
#!/bin/bash | |
cd ~/bin | |
API_KEY=`cat SABnzbd/sabnzbd.ini | grep ^api_key | awk '{print $3}'` | |
PORT=` cat SABnzbd/sabnzbd.ini | grep ^https_port | awk '{print $3}'` | |
VERSION=`curl -s http://sabnzbdplus.sourceforge.net/version/latest | head -n1` | |
VERSION=${VERSION%?} | |
DIR="SABnzbd-${VERSION}" | |
GZ="${DIR}-src.tar.gz" | |
DATE=`date +'%Y%m%d-%H%M'` | |
echo "Downloading SABnzbd ${VERSION} (${GZ})" | |
curl -s -C - -O "http://freefr.dl.sourceforge.net/project/sabnzbdplus/sabnzbdplus/sabnzbd-${VERSION}/${GZ}" | |
echo "Unpacking ${GZ}" | |
tar -xzf ${GZ} | |
rm ${GZ} | |
echo "Shutting down SABnzbd+" | |
curl -s "http://localhost:${PORT}/sabnzbd/api?mode=shutdown&apikey=${APIKEY}" >> /dev/null | |
echo "Installing new SABnzbd+" | |
cp SABnzbd/sabnzbd.ini ${DIR}/sabnzbd.ini | |
mv SABnzbd ~/archives/SABnzbd_${DATE} | |
mv ${DIR} SABnzbd | |
echo "Restarting SABnzdb+" | |
python SABnzbd/SABnzbd.py -d | |
# Go back to the previous directory | |
echo "Upgrade complete !" | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
!/bin/bash
VERSION=
curl -s http://sabnzbdplus.sourceforge.net/version/latest | head -n1
SRCGZIP="SABnzbd-${VERSION%?}-src.tar.gz"
echo "Downloading SABnzbd $VERSION ($SRCGZIP)"
curl http://freefr.dl.sourceforge.net/project/sabnzbdplus/sabnzbdplus/sabnzbd-${VERSION%?}/${SRCGZIP} > ${SRCGZIP}
echo "Unpacking ${SRCGZIP}"
tar -xzf ${SRCGZIP}