Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 05-13-2010, 04:36 PM   #16
ccayer
Member
ccayer is on a distinguished road
 
Posts: 19
Karma: 64
Join Date: May 2010
Device: Dell Axim X50v, JetBook Lite
Quote:
The next release of calibre contains code that will try pretty hard to recover from a corrupted database.
The ability to recover from a corrupted database sounds like a great feature. Even though it's something you hope you never need, it's nice to know that feature is there.

Quote:
I copy metadata.db to metadata.db.1, etc.. I keep 6 copies for the last 6 backups, all the way to metadata.db.6 It's a very simple rename, of metadata.db.1->metadata.db.2, etc. before copying the current metadata.db to metadata.db.1.

I have yet to see a corrupted metadata.db, but if I ever do, I've got all 6 copies backed up every day for months.
The backup of the metadata.db is even more 'insurance' against corruption. Is there a way to have Calibre run a batch file on exit? I can whip up a batch file, similar to the one described, and it would be convenient to have it run automatically when I close Calibre.
ccayer is offline   Reply With Quote
Old 05-13-2010, 05:00 PM   #17
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ccayer View Post
The backup of the metadata.db is even more 'insurance' against corruption. Is there a way to have Calibre run a batch file on exit? I can whip up a batch file, similar to the one described, and it would be convenient to have it run automatically when I close Calibre.
I use Windows Task Scheduler, and it runs at night. Most backup programs will run a pre-backup batch file, and you can put it there,a nd your backup program will run it. However, I don't know of a way to get Calibre to run a batch file on exit. It might be a useful feature for some if you want to request it in the bug tracker.
Starson17 is offline   Reply With Quote
 
Enthusiast
Old 05-13-2010, 05:45 PM   #18
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,454
Karma: 831552
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Starson17 View Post
However, I don't know of a way to get Calibre to run a batch file on exit.
Why not start calibre in a batch file? When it exits, you can do whatever you want.

Note that if you are on windows, there are some issues with using calibre in batch files. You need to use the START command. There was a thread around a month ago that went into detail. I always start calibre with the calibre-debug command and don't have problems, but your mileage might vary.
chaley is offline   Reply With Quote
Old 05-13-2010, 06:49 PM   #19
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
Why not start calibre in a batch file? When it exits, you can do whatever you want.

Note that if you are on windows, there are some issues with using calibre in batch files. You need to use the START command. There was a thread around a month ago that went into detail. I always start calibre with the calibre-debug command and don't have problems, but your mileage might vary.
If you start calibre with a simple command line in the batch file (like you, I do that with "calibre-debug - g" when working on the source) it won't run the next line in the batch, for the reason you mentioned - Calibre has trouble with batch files.

If you put "start" in front, it runs calibre and the next line in the batch, but it runs the next line immediately, not after Calibre exits.

I believe this will work if you install powershell:
Code:
powershell -command - < batchfile.bat
but it's probably easier to use one of the other methods.
Starson17 is offline   Reply With Quote
Old 05-13-2010, 08:43 PM   #20
hnoto
Groupie
hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.hnoto can program the VCR without an owner's manual.
 
hnoto's Avatar
 
Posts: 196
Karma: 177180
Join Date: Jun 2009
Location: Mesa, AZ
Device: Sony PRS 505
Quote:
Originally Posted by dwanthny View Post
I'm a big fan of using the save to disk feature to back up your books, I even wrote procedures here to do just that. The truth is that the simple way to back up your library according to the creator of Calibre is to copy your library folder to another location. By default the metadata.db file is in the root of the library folder.
I'm a pretty simple girl. So I'm glad to hear that my simple idea will work.
hnoto is offline   Reply With Quote
Old 05-13-2010, 09:10 PM   #21
Debby
Connoisseur
Debby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enough
 
Debby's Avatar
 
Posts: 75
Karma: 600
Join Date: Jul 2008
Location: Depends Upon the Season.....
Device: Cybook, Sony & ipad
Starson17, would you mind sharing how you do this in Task Scheduler?

Thanks...
Debby is offline   Reply With Quote
Old 05-14-2010, 01:25 AM   #22
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,454
Karma: 831552
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Starson17 View Post
If you put "start" in front, it runs calibre and the next line in the batch, but it runs the next line immediately, not after Calibre exits.
Try it with 'start /wait'. That causes the original bat file to wait until the subprocess dies. This thread has a fair discussion of the technique along with experiment results.
chaley is offline   Reply With Quote
Old 05-14-2010, 01:28 AM   #23
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,454
Karma: 831552
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Debby View Post
Starson17, would you mind sharing how you do this in Task Scheduler?
I am not starson17 , but you might get some help in this thread.
chaley is offline   Reply With Quote
Old 05-14-2010, 10:13 AM   #24
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
Try it with 'start /wait'
Excellent point, I'd forgotten the /wait option.
Starson17 is offline   Reply With Quote
Old 05-14-2010, 11:48 AM   #25
Debby
Connoisseur
Debby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enough
 
Debby's Avatar
 
Posts: 75
Karma: 600
Join Date: Jul 2008
Location: Depends Upon the Season.....
Device: Cybook, Sony & ipad
Quote:
Originally Posted by chaley View Post
I am not starson17 , but you might get some help in this thread.
Thank you! If someone has something a little more detailed that would help. I can generally follow along if I have examples. For example, with no experience I was able to use the plugin for removing the "unspeakable".

I actually understand how to make the batch file (major step for a non-techie ).
But I am not certain of the syntax for copying the library. I will google using task manager and see if I find examples.

I am looking for way to ensure the library stays backed up since I have had to restore it twice. I am beginning to suspect the issue is the interaction with the reader - since both times this happened I plugged in the Sony 505 to upload books. At least now I understand how to save all the metabooks (with covers)!
Debby is offline   Reply With Quote
Old 05-14-2010, 12:32 PM   #26
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by Debby View Post
But I am not certain of the syntax for copying the library.
...
I am looking for way to ensure the library stays backed up since I have had to restore it twice.
There are many here who will be happy to help you structure what you want. The problem is figuring out what that is - i.e., what you want and what will work for you given the size of your library, when you want the library backed up, etc.

A basic copied Library type of backup has two parts - the books and the metadata.db file. Copying all of the books, each time I exited Calibre, would be impossible for me. It would take far too long, and I seldom exit it.

I think your first question to answer is: "When do you want your library backed up?" If your computer runs 24/7, it's easy - do it at night. If not, perhaps you just want to manually run the batch file, not automatically. Or maybe you prefer when you turn on/off the computer?

You could use a system that copies the ebooks manually (you manually choose to run a backup by starting a batch file), but always backs up metadata.db when you exit. You could choose to run the backup automatically at night, and only leave the computer on at night when you want a backup -telling the Scheduled Task to not run when the computer is off.

What do you think would work for you?
Starson17 is offline   Reply With Quote
Old 05-14-2010, 01:04 PM   #27
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,055
Karma: 777825
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
If you are running Windows then a very simple form of backup is to run a DOS command of the form:
XCOPY /D /S /Y SourceFolder TargetFolder
This will do a copy (including sub-folders), and the /D option tells it to only copy files whose date has changed.

More sophisticated backup solutions will do differential backups and give you the option to return to a nominated point in time. The backup utility that comes as part of Windows will do for most people.
itimpi is online now   Reply With Quote
Old 05-14-2010, 01:10 PM   #28
Debby
Connoisseur
Debby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enough
 
Debby's Avatar
 
Posts: 75
Karma: 600
Join Date: Jul 2008
Location: Depends Upon the Season.....
Device: Cybook, Sony & ipad
Thank you! I typically leave my computer on 24/7 so at night would be the best. I really liked your idea of having 6 files on hand and then deleting the old. What saved me during this last disaster was the ability to use restore in windows. I actually have a backup system in place but it failed. My network back up was full and the system administrator did not catch it (located off site). So, I am going to add my own backup to be safe.

I don't think I need the entire library copied every night - I agree that would be too much. I currently have about 1,000 books. But, the file is not really that big - around 850 MB

1. A complete back up (metadata, covers) once a week. I think the saved disk technique (similar to dwanthny) would be ideal but I don't believe that can automated. So, I will do that manually.

1. In a perfect world (sigh) a back up would occur of the NEW books I added that day (with covers) along with a daily metadata.

Would this work if I needed to restore the library? My goal would be to be able to restore everything completely (including covers and metadata).

Or if I just copy the metadata nightly, what happens if I copy over the metadata and one of the books is not in the library file?
Debby is offline   Reply With Quote
Old 05-14-2010, 01:22 PM   #29
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,838
Karma: 12535517
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by Debby View Post
Quote:
Originally Posted by itimpi View Post
If you are running Windows then a very simple form of backup is to run a DOS command of the form:
XCOPY /D /S /Y SourceFolder TargetFolder
This will do a copy (including sub-folders), and the /D option tells it to only copy files whose date has changed.
1. In a perfect world (sigh) a back up would occur of the NEW books I added that day (with covers) along with a daily metadata.
itimpi's basic batch file backup can easily be setup to run each night. This would back up the NEW books you added that day (with covers) along with a daily metadata.
DoctorOhh is offline   Reply With Quote
Old 05-14-2010, 02:45 PM   #30
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by Debby View Post
1. In a perfect world (sigh) a back up would occur of the NEW books I added that day (with covers) along with a daily metadata.
This is basically what I do. I can suggest some options.

My preference is to run PureSync, a folder synchronization program via a batch file. It operates in one-way mirror mode, compares my backup copy of the Library to my master copy (located on another drive in a networked computer), copies over any new books, deletes any old books that were deleted from the master, and copies over and replaces the metadata.db file (provided it has changed). There are lots of folder synchronization programs around.

Another alternative is to run XCOPY. It can be set to copy only files that have not been backed up and then it sets the archive bit, but that method doesn't delete old books deleted from the master, nor does it work if another backup program is being used.

You can always just copy the entire Library folder every now and then.

As to the multiple metadata.db files, I use something simple like this:

c:
cd \path\to\Calibre\Library
if exist metadata.db.6 del metadata.db.6
if exist metadata.db.5 ren metadata.db.5 metadata.db.6
if exist metadata.db.4 ren metadata.db.4 metadata.db.5
if exist metadata.db.3 ren metadata.db.3 metadata.db.4
if exist metadata.db.2 ren metadata.db.2 metadata.db.3
if exist metadata.db.1 ren metadata.db.1 metadata.db.2
if exist metadata.db copy metadata.db metadata.db.1

You can put it in a batch file, run it nightly with a Windows scheduled task, or before your backup.
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Corrupted files speakingtohe Calibre 2 08-20-2010 04:31 PM
Corrupted Metadata Marcy Calibre 31 07-27-2010 10:50 AM
Corrupted File? StealthyScribe Kobo Reader 8 07-21-2010 10:09 PM
PRS-600 Index corrupted? CapnKirk Sony Reader 0 07-10-2010 06:56 PM
Library corrupted rozie123 Sony Reader 1 05-26-2009 07:02 AM


All times are GMT -4. The time now is 04:39 AM.


MobileRead.com is a privately owned, operated and funded community.