Re[2]: Prevent to exec second copy of application



Create a lock file is no a good idea, because of
1)To block file I need something like 
fcntl(...,F_SETLK,...), but this functionality is not implement on several file systems (nfs for example).

2)I need to prevent start of application copy on one display, not in whole system.

-----Original Message-----
From: Andreas Volz <andreas volz brachttal net>
To: jakonda jakarta <janjakon mail ru>
Date: Sat, 13 Nov 2004 14:34:35 +0100
Subject: Re: Prevent to exec second copy of application


Am Sat, 13 Nov 2004 14:41:53 +0300 schrieb jakonda jakarta:

May be there is another algorithm to prevent starting second copy of
application in the same dipslay?

Hi,

a very easy idea is to use a lock-file. Just create a file in
/var/lock/yourapp. And if you start the application see if that file
exists. The only problem is if your app doesn't close propper. Then
there's an lock file. But perhaps there're some good concepts to handle
this, because lot of apps do it this way.

regards
Andreas



http://Mail.Ru - лучшая почта с неограниченным объемом почтового ящика!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]