Page 1 of 1

SABnzbd, SickBeard, CouchPotato to Dropbox Backup script

Posted: November 22nd, 2011, 9:37 am
by bbaraniec
Hi,

It's not really Post-Processing script but I have no idea where to post it.
I've written a simple script that will Backup SABnzbd, SickBeard and CouchPotato settings and databases as password protected files to Dropbox folder. My knowledge about scripting is poor, so most likely it could be done better/cleaner but it does the job for me. Just add it to cron as you like. I'm not deleting any files, so you might want to check once in while if your Dropbox has still free space. If you don't have Dropbox account yet, pm for referral link, you will get extra 250MB free.
To avoid questions or confusion my lvm Volume Group is called "c" :)
I'm not taking any responsibility anything bad should happen. It shouldn't but just to be safe :)

Code: Select all

#!/bin/sh
### Info ###
# Script will Backup SABnzbd, SickBeard, CouchPotato configs/databases as password protected zip files to Dropbox;
# Files included in Backups: SABnzbd - /admin/ & sabnzbd.conf; SickBeard - config.ini & sickbeard.db; CouchPotato - config.ini & data.db;
# Requirements - Dropbox linux client, mailutils for mail notifications;

### Global settings ###
#Dropbox Backup folder location (you need to create it manually), no "/" at the end;
dropbox=/c/Dropbox
#Zip files password (you need to have one, at least for now)
password="password"
### Services settings ###
# "daemon" - 1/0 - (Backup Yes/No);
# "location" - SABnzbd, SickBeard, CouchPotato folder(s) (no "/" at the end);
# "filename" - Backup(s) file name(s) without extension, current date in format dd-mm-yyyy will be added to file name (example SABnzbd-08-11-11.zip);

#SABnzbd settings
sab_deamon=0
sab_location=/c/.sabnzbd
sab_filename=SABnzbd
#SickBeard settings
sb_deamon=0
sb_location=/c/.sickbeard
sb_filename=SickBeard
#CouchPotato settings
cp_deamon=0
cp_location=/c/.couchpotato
cp_filename=CouchPotato

### Notification settings ###
#Create log file (located in Drobpox folder)
log=0
log_filename=!log.txt
#Mail notification
mail_notification=0
email=email address goes here
subject="Backup status"

### Backups status ###
sab_status=""
sb_status=""
cp_status=""

### Creating SABznbd Backup file ###
if [ $sab_deamon -eq 1 ] ; then
    zip -r -q -P $password $dropbox/$sab_filename-`date +%d-%m-%Y`.zip $sab_location/sabnzbd.conf $sab_location/admin/
    if [ -f $dropbox/$sab_filename-`date +%d-%m-%Y`.zip ]
   then sab_status="Backup successful"
   else sab_status="Backup failed"
    fi
    else sab_status="Backup not configured"
fi

### Creating SickBeard Backup file ###
if [ $sb_deamon -eq 1 ] ; then
    zip -r -q -P $password $dropbox/$sb_filename-`date +%d-%m-%Y`.zip $sb_location/config.ini $sb_location/sickbeard.db
    if [ -f $dropbox/$sb_filename-`date +%d-%m-%Y`.zip ]
   then sb_status="Backup successful"
   else sb_status="Backup failed"
    fi
    else sb_status="Backup not configured"
fi

### Creating CouchPotato Backup file ###
if [ $cp_deamon -eq 1 ] ; then
    zip -r -q -P $password $dropbox/$cp_filename-`date +%d-%m-%Y`.zip $cp_location/config.ini $cp_location/data.db
    if [ -f $dropbox/$cp_filename-`date +%d-%m-%Y`.zip ]
   then cp_status="Backup successful"
   else cp_status="Backup failed"
    fi
    else cp_status="Backup not configured"
fi

### Creating log file ###
if [ $log -eq 1 ] ; then
echo -e "Backup status: $(date +%d-%m-%Y)\r
SABznbd: $sab_status\r
SickBeard: $sb_status\r
CouchPotato: $cp_status\r
---\r" >> $dropbox/$log_filename
fi

#### Sending e-mail ###
if [ $mail_notification -eq 1 ] ; then
mail -s "$subject" $email <<< "Backup status: $(date +%d-%m-%Y)
SABnzbd: $sab_status
SickBeard: $sb_status
CouchPotato: $cp_status
---"
fi

Re: SABnzbd, SickBeard, CouchPotato to Dropbox Backup script

Posted: November 24th, 2011, 1:15 am
by Mar2zz
Good idea. You do not backup everything. For example, in case you want couchpotato to save pictures also you should save more files (and subfolders):
These are files/folders created by using those apps:, recommended to backup them all.
Couchpotato: cache config.ini data.db logs
Sickbeard: cache cache.db config.ini Logs sickbeard.db sickbeard.db.v0
Headphones: cache headphones.db logs

Also, it's wise to check if locations exist before backing up to prevent errors (for example):
[ -d $cp_location ] || cp_daemon=0

Re: SABnzbd, SickBeard, CouchPotato to Dropbox Backup script

Posted: August 7th, 2012, 5:28 am
by xhoza
does this script work?