How to prevent a stack from loading twice (in Linux)

Bernard Devlin bdrunrev at gmail.com
Sat May 23 09:33:01 EDT 2009


Peter, you could also use shell() to parse the output of the ps
command to check if your application is already running, and then exit
a  2nd instance if one is found to be in the running processes.

Bernard

On Sat, May 23, 2009 at 1:04 PM, Jan Schenkel <janschenkel at yahoo.com> wrote:

> I'm sure some Unix zealots might come and whack your fingers off if you try and take that behaviour away from them ;-)
>
> Seriously, there's no built-in way to prevent it; but you can always employ a crude locking mechanism by writing a myapp.lk file somewhere, and refusing to open the application when that file is already present.
> Or you can open a server socket on a fixed port, and quit if you fail to grab that port; the added advantage of the socket approach being that you can use the server socket to receive an 'open file' message from the second started instance.
>
> Jan Schenkel



More information about the use-livecode mailing list