There are several instructions on how to use the KeePass2 trigger mechanism to create a backup of your password database when saving the database. However, all of the instructions I found were for Windows. It took a bit of figuring out what is the proper configuration on Linux, so here are the necessary steps:
- Select Tools → Triggers…
- Click Add…
- Type the name
Backup database on save
and make sure Enabled and Initially on are checked - Under the Events tab click Add…, select Saving database file and click OK (ignore the conditions)
- Under the Actions tab click Add…, select Execure command line / URL and type in the following:
File/URL:cp
Arguments:"{DB_PATH}" "{DB_PATH}.{DT_SIMPLE}"
Wait for exit: checked - Click OK a few times
This will create a backup of the database file every time you save it (before the save). The backup will be in the same directory as the original, with the current timestamp appended to the name. If you prefer to backup to a different directory, use "/path/to/backups/{DB_BASENAME}.{DT_SIMPLE}"
as the second argument instead.
Since this is not working (for me), do you happen to know, how to debug, why this isnt working?
Interesting post. However, how can we make a line that works both for linux and windows? Right now I followed a tutorial for windows and assumed it would work on linux by using the “{END_DIRSEP}”, to no avail. I’m surprised because the tutorial I followed use the command “mkdir” that exist on linux, but the folder is never created.
How can we debug triggers? I know it is launched (by adding a message box), but that’s it.
Thanks for your post, worked for me