Code Monkey home page Code Monkey logo

simpledatabasebackup's Introduction

SimpleDatabaseBackup

SimpleDatabseBackup is a KeePass plugin which was created for simpleness. There is no setup, no GUI and no configuration. Just install and go. That's all.

What is this plugin for?

It will create a backup for every opened KeePass database (.kdbx) every time a database with changes is being saved. The backups will be placed in the databases source folder, with a maximum of 5 backups. The backups will be rotated, newest in, oldest out. SimpleDatabaseBackup is fully cross-platform compatible.

NOTE: SimpleDatabaseBackup currently creates local backups only. Since most users having their database in some sort of local-to-cloud syncfolder that's ok because the backups are being synced by the cloud application. Remote databases (sftp, scp, ftps) are not supported currently. I'm working on this but this is more complicated and I've to do this on my spare time. Please be patient in this point...

Download

The compiled plugin can be downloaded here:

https://github.com/jnko/SimpleDatabaseBackup/raw/master/SimpleDatabaseBackup.plgx

Installing SimpleDatabaseBackup plugin

Please follow the KeePass documentation: https://keepass.info/help/v2/plugins.html

In short: Just put it into the KeePass.exe folder.

Updating the SimpleDatabaseBackup plugin

To update quit KeePass and overwrite the older release. That's all. After updating the plugin please always manually remove the backup databases.

Can I change the number of backups ?

At the time of writing this the number of backups is hard-coded into the sources, but you may follow the excellent documentation on the KeePass website and build your own customized plugin or you can create an issue here and if there is some need from the users I will add this freature request.

Further information

This plugin is heavily based on the DatabaseBackup plugin written by Francis Noël which you can find here:

https://keepass.info/plugins.html#databasebackup

There is no license or copyright information left in the original sources so I hope Franics allows me to re-use parts of his code. If not, please leave me a note.

I created this small plugin because I use KeePass daily with one personal and one shared business database. Even not enough on I need to do this on cross-platform operating systems every day. People tend to make mistakes from time to time. That is the right moment for backups.

At the time I only used Windows with Francis DatabaseBackup plugin everything was fine, but since I need to switch between Windows, macOS and Linux I realized that Francis plugin doesn't play nicely. It has some serious bugs when using multiple databases and the path names were not cross-platform compatible. So I forked DatabaseBackup, removed the GUI, stripped out everything unneeded and modified it for my needs - cross-platform, simple, silent ==> SimpleDatabaseBackup

History

  • 1.0.8 Fixed the possibility to accidentally delete databases with underscore in filenames which were treated as backup files. Please manually delete all backup file before.
  • 1.0.7 Major bugfix. Rewritten the complete backup logic. Now SDB never would forget to delete old backups - even when stored on shared cloud folders.
  • 1.0.6 Minor bugfix. Removed some unused references to increase compatibility (Yes, it's true - Someone is still using WindowsXP)
  • 1.0.5 Fixed a bug which caused an unhandled exception when saving a new database.
  • 1.0.4 Fixed a bug that prevents the entrie backup.
  • 1.0.3 Added KeePass update notifications; A database will be backed-up only when modified.
  • 1.0.1 First public release.

simpledatabasebackup's People

Contributors

jnko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpledatabasebackup's Issues

Potential problem deleting wrong database

First of all: Thank you for your effort on this PlugIn! 👍

I just poked a bit through the code and thought about the way populating the bakFiles array: With the _*.kdbx-filter, it could be possible, that a non-backup database file gets added (and backup files from other databases). For example, if (an organisation) has the main database file example.kdbx and some other departments-only, like example_support.kdbx.
Depending on the constellation and number of backups of both files, example_support.kdbx could be deleted on the next save/write-out of KeePass to example.kdbx.

If I'm not too tired to think clearly, one solution could be to append .backup-[TIMESTAMP] to all backup files.

I'm not affected by this problem (as I use a hyphen to separate my database file names), so it's nothing urgen. Just wanted to share my thoughts about this. :-)

The following plugin is incompatible with the current KeePass version ...

Hi, jnko!

Have error while starting keepass:

"The plugin cannot be loaded"
"The following plugin is incompatible with the current KeePass version:
<...>\Plugins\SimpleDatabaseBackup.plgx

Have a look at the plugin's website for an appropriate version."

Environment:
SimpleDatabseBackup ver.1.0.5
KeePass 2.34 (portable inst.)
OS: Windows XP

Note:
DataBaseBackup 2.0.8.6 plugin by Francis Noël loaded without errors.

Best regards
Victor.

Plugin doesn't delete old backups

I'm on Archlinux and SimpleDatabaseBackup isn't removing the old backups, only creates new ones.
The logfile only shows the last six!

Directory files:

kpdb_13-Janeiro-2017-07-07-36.kdbx
kpdb_13-Janeiro-2017-07-16-56.kdbx
kpdb_13-Janeiro-2017-07-18-23.kdbx
kpdb_13-Janeiro-2017-07-28-58.kdbx
kpdb_13-Janeiro-2017-07-29-42.kdbx
kpdb_13-Janeiro-2017-07-44-42.kdbx
kpdb_14-Janeiro-2017-06-10-34.kdbx
kpdb_14-Janeiro-2017-10-40-24.kdbx
kpdb_22-Janeiro-2017-07-45-16.kdbx
kpdb_22-Janeiro-2017-08-06-25.kdbx
kpdb_22-Janeiro-2017-09-50-25.kdbx
kpdb_23-Janeiro-2017-01-50-41.kdbx
kpdb_23-Janeiro-2017-07-22-46.kdbx
kpdb_25-Janeiro-2017-07-18-40.kdbx
kpdb_26-Janeiro-2017-01-30-58.kdbx
kpdb_27-Janeiro-2017-01-45-45.kdbx
kpdb.kdbx
kpdb.kdbx_log
kpdb_13-Janeiro-2017-05-45-07.kdbx 

logfile:

kpdb_27-Janeiro-2017-01-45-45.kdbx
kpdb_26-Janeiro-2017-01-30-58.kdbx
kpdb_25-Janeiro-2017-07-18-40.kdbx
kpdb_23-Janeiro-2017-07-22-46.kdbx
kpdb_23-Janeiro-2017-01-50-41.kdbx
kpdb_22-Janeiro-2017-09-50-25.kdbx

Envoriment:
Archlinux
mono 4.6.1.3
KeePass 2.35

Problem with other sync actions defined in triggers

Hi Joern,
I just realized a little issue with your plugin, which is otherwise working very well.

SDB does not create a backup file only when the database was saved but also everytime when there are triggers defined with the action "Synchronize active database with a file/URL". In my case I was syncing the database with three external cloud folders, so SDB is making one backup for the save, and three other backups for the sync.

Hmmmh. ;-)

Can you fix it?

Kind regards from Berlin/Germany.
MatzeDE

SDB Installation problem

Hi, I have problems with installig this plugin.

Install instruction from readme file:
(# Installing SimpleDatabaseBackup plugin
Please follow the KeePass documentation: http://keepass.info/help/v2/plugins.html
In short: Just put it into the KeePass.exe folder.)

I copied the SDB plugin folder in the keepass.exe folder, but it won´t work.
I also copied the SimpleDatabaseBackup.plgx file in keepass.exe folder, but this won´t work either.

Can you pls tell me how should i install it.

Thank you very much for your answer.

Backup problem at sync

Hello,

first I like to say thank you for providing the plugin.

I just test it after destroying my database with sync. When I save everything was ok.

I tested then with the sync. The database before sync has about 400k and after the sync 8000k. But the backup file was only 400k big.

I thought that the backup is the state of the database after writing the new changes to disk. Is that right?
If I'm wrong please improve the description on the plugin page https://keepass.info/plugins.html

If I'm right the size of the backup should also by 8000k.

I hope you can enlighten ;-) me or fix it.

When to databases are synced than both databases where saved. But the file I enter to sync with the actual database have backup after the sync. This should not be.

Thanks
Itsalltext

Problem If saving backup to OneDrive

If you let the plugin save the backup to a OneDrive folder, OneDrive stops syncing this folder until you restart your computer.

I was testing this on Windows 10

Backups when saving an FTP stored file

Would it be possible to either

  1. Create a backup remotely of the file when it's stored on an FTP site, or
  2. Create a local copy of the file where the application is installed (C:\Program Files.....) when saving TO the FTP site?

Just an idea - thanks for considering.

Not working

Hi, i copied the simpledatabase backup on the program folder, i can see in in the plugins of keepass (latest version), but i just saved my database and i see no backup file on the database folder.
Am saving on the google drive using the local path C:\Users\username\Google Drive\Personal\KeepPass Database
but i tested it with another database on the local path and again no backups

Am i doing something wrong ?

thank you

Not closed Window of "Path to Backup not found" occurs after a while an .NET Exception

Error-Message on Windows 7:

Informationen über das Aufrufen von JIT-Debuggen
anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

-************** Ausnahmetext **************
System.ArgumentException: Der Pfad hat ein ungültiges Format.
bei System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
bei System.IO.Path.GetFullPathInternal(String path)
bei System.IO.FileInfo.Init(String fileName, Boolean checkHost)
bei DataBaseBackup.Helper.GetLogFileName(IPluginHost host)
bei DataBaseBackup.DataBaseBackupExt._BackupDB()
bei DataBaseBackup.DataBaseBackupExt.OnFileSaved(Object sender, FileSavedEventArgs e)
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei KeePass.Forms.MainForm.SaveDatabase(PwDatabase pdToSave, Object sender)
bei KeePass.Forms.MainForm.CloseDocument(PwDocument dsToClose, Boolean bLocking, Boolean bExiting, Boolean bEcas, Boolean bUpdateUI)
bei KeePass.Forms.MainForm.LockAllDocuments()
bei KeePass.Forms.MainForm.OnTimerMainTick(Object sender, EventArgs e)
bei System.Windows.Forms.Timer.OnTick(EventArgs e)
bei System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

-************** Geladene Assemblys -**************
mscorlib
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3324.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll.

KeePass
Assembly-Version: 2.41.0.19744.
Win32-Version: 2.41.0.0.
CodeBase: file:///C:/Program%20Files%20(x86)/KeePass%20Password%20Safe%202/KeePass.exe.

System
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3353.0 built by: NET472REL1LAST_B.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll.

System.Windows.Forms
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3324.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.

System.Drawing
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3221.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.

System.Configuration
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3324.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll.

System.Core
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3324.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll.

System.Xml
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3221.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll.

System.Windows.Forms.resources
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3062.0 built by: NET472REL1.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.

IOProtocolExt
Assembly-Version: 1.16.0.0.
Win32-Version: 1.16.0.0.
CodeBase: file:///C:/Program%20Files%20(x86)/KeePass%20Password%20Safe%202/Plugins/IOProtocolExt-1.16/IOProtocolExt.dll.

System.resources
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3062.0 built by: NET472REL1.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.resources/v4.0_4.0.0.0_de_b77a5c561934e089/System.resources.dll.

DataBaseBackup
Assembly-Version: 2.0.8.6.
Win32-Version: 2.0.8.6.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/dBl1XeI1cqoxNRs6LpVS/DataBaseBackup.dll.

KeePassQuickUnlock
Assembly-Version: 2.4.0.0.
Win32-Version: 2.4.0.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/Ej3UkPtiFXEvrLqU6Zc1/KeePassQuickUnlock.dll.

KeePassRPC
Assembly-Version: 2.0.34.27941.
Win32-Version: 1.8.0.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/8UsRMUrfthPScL1EQMLm/KeePassRPC.dll.

Fleck2
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/8UsRMUrfthPScL1EQMLm/Fleck2.DLL.

DomainPublicSuffix
Assembly-Version: 2.0.1.0.
Win32-Version: 2.0.1.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/8UsRMUrfthPScL1EQMLm/DomainPublicSuffix.DLL.

Jayrock
Assembly-Version: 0.9.12915.0.
Win32-Version: 0.9.11214.1056.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/8UsRMUrfthPScL1EQMLm/Jayrock.DLL.

KeePassVeraCryptMount
Assembly-Version: 1.0.6989.22981.
Win32-Version: 1.0.7.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/zomyjB0GLkO3jJW7eFRh/KeePassVeraCryptMount.dll.

QrCodeGenerator
Assembly-Version: 2.0.12.0.
Win32-Version: 2.0.12.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/vi9TfTFcR8AVW8VsaZbL/QrCodeGenerator.dll.

YetAnotherFaviconDownloader
Assembly-Version: 1.2.0.0.
Win32-Version: 1.2.0.0.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/V6A9lK5VemveGChbydTp/YetAnotherFaviconDownloader.dll.

KeePass.XmlSerializers
Assembly-Version: 2.41.0.19744.
Win32-Version: 2.41.0.19744.
CodeBase: file:///C:/Program%20Files%20(x86)/KeePass%20Password%20Safe%202/KeePass.XmlSerializers.DLL.

System.Security
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3221.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll.

Jayrock.Json
Assembly-Version: 0.9.12915.0.
Win32-Version: 0.9.13422.2206.
CodeBase: file:///C:/Users/-----/AppData/Local/KeePass/PluginCache/8UsRMUrfthPScL1EQMLm/Jayrock.Json.DLL.

System.Numerics
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3062.0 built by: NET472REL1.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll.

Microsoft.GeneratedCode
Assembly-Version: 1.0.0.0.
Win32-Version: 4.7.3221.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll.

System.Data
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3260.0 built by: NET472REL1LAST_C.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll.

mscorlib.resources
Assembly-Version: 4.0.0.0.
Win32-Version: 4.7.3062.0 built by: NET472REL1.
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_de_b77a5c561934e089/mscorlib.resources.dll.

-************** JIT-Debuggen -**************
Um das JIT-Debuggen (Just-In-Time) zu aktivieren, muss in der
Konfigurationsdatei der Anwendung oder des Computers
(machine.config) der jitDebugging-Wert im Abschnitt system.windows.forms festgelegt werden.
Die Anwendung muss mit aktiviertem Debuggen kompiliert werden.

Zum Beispiel:

Wenn das JIT-Debuggen aktiviert ist, werden alle nicht behandelten
Ausnahmen an den JIT-Debugger gesendet, der auf dem
Computer registriert ist, und nicht in diesem Dialogfeld behandelt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.