0

For example:

I code a client process named myProcess .

I will run it 3 times : ./myProcess

Then i ps x | grep myProcess, i get this :

21662 ?        Ss     0:00 ./myProcess
21758 ?        Ss     0:00 ./myProcess
21878 ?        Ss     0:00 ./myProcess .

But what i want is no matter how many times i run it,there's only one instance of this myProcess.

Somebody suggests me i can do it with the file lock.But is there any other solution ?

Do you guys get some solutions? thanks.

杜智超
  • 577
  • 1
  • 4
  • 11

0 Answers0