Best way to backup SABnzbd?

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
josiahrulez
Newbie
Newbie
Posts: 6
Joined: March 8th, 2012, 1:01 pm

Best way to backup SABnzbd?

Post by josiahrulez »

Hey all,

So I'm looking for the best way to automatically backup sabnzbd.

I was planning on using ubuntu backup to automatically backup my sabnzbd folder. But would there be a problem backing up while sabnzbd is still running? or should i write a script to shutdown sabnzbd first then backup the folder?
AutomaticCoding
Newbie
Newbie
Posts: 27
Joined: January 2nd, 2013, 5:20 am

Re: Best way to backup SABnzbd?

Post by AutomaticCoding »

Code isn't mine, credits to whoever made it, which, I honestly couldn't tell you who it is:-

To stop sabnzbd (Obviously will need editing):-

Code: Select all

sabnzbd_stop()
{
	# no-op if not running
	if [ ! -r /var/run/sabnzbd/sabnzbd-$PORT.pid ]; then
		return
	fi
	
	echo "Stopping SABnzbd..."
	sleep 1
	
	if [ -d $DATADIR ] && [ -f $DATADIR/sabnzbd.ini ]; then
		APIKEY=`grep -w api_key $DATADIR/sabnzbd.ini | cut -d " " -f3`
		IP=$(ifconfig  | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | grep -v '^5' | awk '{ print $1}')
		RES=$(wget -qO - "http://$IP:$PORT/sabnzbd/api?mode=shutdown&apikey=$APIKEY")
		if [[ $RES != "ok" ]]; then
			kill $(cat /var/run/sabnzbd/sabnzbd-$PORT.pid)
		fi
	else
		kill $(cat /var/run/sabnzbd/sabnzbd-$PORT.pid)
	fi
	sleep 3

	if [ -e /var/run/sabnzbd/sabnzbd-$PORT.pid ]; then
		kill -9 $(cat /var/run/sabnzbd/sabnzbd-$PORT.pid )
		rm /var/run/sabnzbd/sabnzbd-$PORT.pid
	fi
	echo "... OK"
	sleep 1
}
then just something like:-

Code: Select all

cp $datadir /backupDir/$date/
then back to:-

Code: Select all

sudo -u yourSabnzbdDaemonAccount python sabnzbd
The above code probably isn't the best way, but, it works.

EDIT:- As for your question, the only way to be sure is to check sabnzbd's saving script, however, my GUESS would be:-
Don't save while it's open, although it will recover (Assuming you back EVERYTHING up, not just sabnzbd.ini), if it's currently unraring/par2ing something it'll probably start spewing errors when you load it back up from the backup.
josiahrulez
Newbie
Newbie
Posts: 6
Joined: March 8th, 2012, 1:01 pm

Re: Best way to backup SABnzbd?

Post by josiahrulez »

Well i learnt that hyper-v hosts don't like ubuntu, so i had to force reset my downloadbox yesterday and lost my queue.

so i was backing up with the ubuntu backup utility and restored the queue ok. But i may look at oracle virtual box and try setup automatic snapshots.
Post Reply