Bug 475674 - Create a Lock File when running KMyMoney
Summary: Create a Lock File when running KMyMoney
Status: REPORTED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-16 00:05 UTC by Brendan
Modified: 2023-10-27 01:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brendan 2023-10-16 00:05:06 UTC
I use KMM on multiple systems. My data file is shared between my various Linux systems and several backup servers via Synthing.

When I forget to close KMM before opening it on a different system, I can end up with 2 versions of the KMM data file.

I have created a workaround with a script that starts KMM (kmymoney.sh). It checks to see if there is a lock file present at the designated path. If the lock file is present, I use Zenity to display a message that file is already open on a different system and I display the name of the system where KMM is already running.

If the lock file is not present, I create the lock file which has the same name as the KMM data file that I am trying to open plus .lock. The lock file has the name of the host that is running KMM. Synthing syncs this file to my backup systems and any system that is online immediately. If I put a system to sleep without closing KMM, the lock file is still present. If I then wake up or boot up a different system, it will receive the lock file and prevent me from running KMM with the same data file.

It would be ideal if KMM handled all of this internally. By default i think the lock file should be stored in the same path as the data file but it might make sense to make it configurable. The home directory would not work for my setup since I do not sync my entire home directory with Syncthing.