how to make sure only one Moneydance running in Linux

Leo's Avatar

Leo

10 Mar, 2010 12:11 PM

Indeed it is a problem if in Linux you don't notice you have multiple Moneydance running. Here I offer my solution. It isn't perfect, but good enough. They key idea is using the following command to invoke Moneydance (you may have to adjust its location):

sh -c "if ! ps -ef | grep -q 'moneydance\.jar' ; then ~/Moneydance/Moneydance ; fi"

In plain English: Only if no process is running that was invoked with moneydance.jar on the command line then invoke Moneydance.

For completeness sake, here is my complete setup. Fedora 12. Moneydance 2010r2 (735).

Get Linux (x86 processor, does not include Java)

Install with
tar -x -z -f ~/Downloads/Moneydance_linux_x86.tar.gz -C ~

See it running at first with
~/Moneydance/Moneydance

But then for ongoing use
In top edge panel → right-click → Add to Panel…
Custom Application Launcher
Type: Application
Name: Moneydance
Command: sh -c "if ! ps -ef | grep -q 'moneydance\.jar' ; then ~/Moneydance/Moneydance ; fi"
Drag icon file ~/Moneydance/moneydance_icon32.png and drop onto the icon area in Launcher Properties

From then on just click that application icon. If it is running already nothing happens, you won't corrupt data.

  1. 1 Posted by Tom on 11 Mar, 2010 02:59 PM

    Tom's Avatar

    Thanks, I now have an explanation of how I clobbered my data file a few days ago. I had minimized one instance of Moneydance, forgot I did this, and opened a second instance.

    I used the Moneydance Linux installer script so here is a version of your command for the default Moneydance location used by this script:

    If there is an instance of Moneydance already running, would their be some way for your script to return the focus to this instance and/or un-minimize it?

  2. 2 Posted by Tom on 11 Mar, 2010 03:01 PM

    Tom's Avatar

    This disappeared when I posted my comment; here's the modified command:

    /bin/sh -c "if ! ps -ef | grep -q 'moneydance\.jar' ; then /opt/moneydance/Moneydance ; fi"
    
  3. Angie Rauscher closed this discussion on 01 May, 2010 07:27 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac