Page 1 of 1

Backup sabnzbd.ini at start of launch.

Posted: April 14th, 2012, 11:45 am
by Norbertus
When launching SABnzbd it would be nice if the current version checks the sabnzbd.ini file for the current version and last backup date.

This could help with:
- accidental deletes that could now be restored;
- added/removed/default settings which can be preserved with an update;
- using profiles such as 'low cpu' and 'high cpu'.

O0

Re: Backup sabnzbd.ini at start of launch.

Posted: April 14th, 2012, 2:22 pm
by sander
I don't completely understand you, but maybe this helps:


sander@R540:~$ cp ~/.sabnzbd/sabnzbd.ini ~/.sabnzbd/sabnzbd.ini-`date +'%F-%R'`

Code: Select all

sander@R540:~$ ll ~/.sabnzbd/sabnzbd.ini*
-rw-rw-r-- 1 sander sander 6192 2012-04-14 11:17 /home/sander/.sabnzbd/sabnzbd.ini
-rw-rw-r-- 1 sander sander 6192 2012-04-14 21:19 /home/sander/.sabnzbd/sabnzbd.ini-2012-04-14-21:19
This is on Linux. As I guess you're on OSX, this should work too. So create a batch file like

Code: Select all

cp ~/.sabnzbd/sabnzbd.ini ~/.sabnzbd/sabnzbd.ini-`date +'%F-%R'`
sabnzbdplus
You'll probably have to change (directory) names for OSX

HTH

Re: Backup sabnzbd.ini at start of launch.

Posted: April 14th, 2012, 2:43 pm
by Norbertus
The option would be more like:

Code: Select all

if # test file date and version here
  cp ~/.sabnzbd/sabnzbd.ini ~/.sabnzbd/backup/sabnzbd.ini-`head -n1 ~/.sabnzbd/sabnzbd.ini|cut -c3-11` 
fi
Where the first line of sabnzbd.ini would be something like:

Code: Select all

# v0.7.14
# This sabnzbd.ini was automatically generated. To change, start SABnzbd, or make a copy first and select 'use backup' from the CONFIG menu.
#
which results in:

Code: Select all

-rw-r--r--   1 sabuser   staff    11 14 Apr 23:33 sabnzbd.ini-v0.7.14
It could be added as a crontab from SABnzbd, with a separate script, or in OS X and Windows a 'helper' service, a separate option to add when installing SABnzbd.

Re: Backup sabnzbd.ini at start of launch.

Posted: April 14th, 2012, 2:54 pm
by sander
So ... are you using this?

Re: Backup sabnzbd.ini at start of launch.

Posted: April 14th, 2012, 3:44 pm
by Norbertus
Not yet, it involves some changes:
- First of all, SABnzbd has to rewrite the sabnzbd.ini file each time it starts, to make sure the first lines are correct, or at least check the first line and compare it with the current (running) version of SABnzbd.
- Second issue will be that a 'file list' has to be made, listing all possible backup files (limit = 10?) that could be used to restore the current settings, disabling version that aren't compatible.
- Backups may have to be verified for integrity.

It can be compared to the how Linux/*x cycles the syslog files, but with an extra check when reading the files back.

I could write a sample script if I can find time, but I don't expect such a feature before version 0.7.12.

Re: Backup sabnzbd.ini at start of launch.

Posted: April 15th, 2012, 5:03 am
by Norbertus
Update:

I noticed SABnzbd makes only one backup of the .ini file at this moment. My request would be an extension of this feature with a rollback function to restore old settings.

Re: Backup sabnzbd.ini at start of launch.

Posted: April 20th, 2012, 4:08 pm
by Norbertus
Another addition to the request:

Different versions of SABnzbd use different locations to store the sabnzbd.ini. I wouldn't know where it could be found on Windows Vista for instance. It would be nice if SABnzbd would take care of the backup/restore instead of an external script.

Re: Backup sabnzbd.ini at start of launch.

Posted: April 21st, 2012, 2:12 am
by shypike
SABnzbd stores its info in the standard location for each OS,
As documented here: http://wiki.sabnzbd.org/configure-v2