I had the same question tonight! On Windows (using C#) I just create a 
Named Mutex, which is system wide. One of values that it returns identifies 
that if the mutex is already created by other instance, or it's the first 
time it's being created on this system.

Is there something similar on Linux?

On Tuesday, July 19, 2011 at 3:55:45 PM UTC+4:30, Dave Cheney wrote:
>
> Hi. 
>
> This is a glib answer, but you should check the resource that your 
> application requires to be a singleton.
>
> If that is a TCP port, then exit if you cannot bind. If it's a database, 
> then use a lock file, etc. 
>
> This isn't a Go specific problem. If you can give some more details, maybe 
> someone will be able to give a more specific answer. 
>
> Cheers
>
> Dave
>
> Sent from my iPhone
>
> On 19/07/2011, at 16:56, Ruslan Mezentsev <rmib....@gmail.com 
> <javascript:>> wrote:
>
> > Hello.
> > How check only one instance of program is running? Use sockets,
> > mutexes or pid files, or other?
> > Thanks.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to