Backup sabnzbd.ini at start of launch.

Want something added? Ask for it here.

Backup sabnzbd.ini at start of launch.

Postby Norbertus » April 14th, 2012, 12:45 pm

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
User avatar
Norbertus
Newbie
Newbie
 
Posts: 33
Joined: January 21st, 2011, 3:11 pm

Re: Backup sabnzbd.ini at start of launch.

Postby sander » April 14th, 2012, 3:22 pm

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
User avatar
sander
Release Testers
Release Testers
 
Posts: 3556
Joined: January 22nd, 2008, 3:22 pm

Re: Backup sabnzbd.ini at start of launch.

Postby Norbertus » April 14th, 2012, 3:43 pm

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.
User avatar
Norbertus
Newbie
Newbie
 
Posts: 33
Joined: January 21st, 2011, 3:11 pm

Re: Backup sabnzbd.ini at start of launch.

Postby sander » April 14th, 2012, 3:54 pm

So ... are you using this?
User avatar
sander
Release Testers
Release Testers
 
Posts: 3556
Joined: January 22nd, 2008, 3:22 pm

Re: Backup sabnzbd.ini at start of launch.

Postby Norbertus » April 14th, 2012, 4:44 pm

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.
User avatar
Norbertus
Newbie
Newbie
 
Posts: 33
Joined: January 21st, 2011, 3:11 pm

Re: Backup sabnzbd.ini at start of launch.

Postby Norbertus » April 15th, 2012, 6:03 am

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.
User avatar
Norbertus
Newbie
Newbie
 
Posts: 33
Joined: January 21st, 2011, 3:11 pm

Re: Backup sabnzbd.ini at start of launch.

Postby Norbertus » April 20th, 2012, 5:08 pm

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.
User avatar
Norbertus
Newbie
Newbie
 
Posts: 33
Joined: January 21st, 2011, 3:11 pm

Re: Backup sabnzbd.ini at start of launch.

Postby shypike » April 21st, 2012, 3:12 am

SABnzbd stores its info in the standard location for each OS,
As documented here: http://wiki.sabnzbd.org/configure-v2
User avatar
shypike
Administrator
Administrator
 
Posts: 16723
Joined: January 18th, 2008, 1:49 pm


Return to Feature Requests