race condition when starting multiple vncservers simultaneously

Martin Grill m.grill "at" lancaster.ac.uk
Tue Apr 3 14:14:01 2007


Hello,

we use realvnc for some of our automated data visualisation. Therefore 
we frequently launch "vncserver" automatically through a crontab entry.

Recently, it just so happened that we were launching two instances of 
vncserver simultaneously. This leads to a race condition, with both 
servers potentially claiming the identical X display number.

Is there an easy way to avoid this (apart from the obvious "don't start 
two instances simultaneously")? It is difficult to guarantee that we 
will never ever launch two instances of vncserver simultaneously, since 
on a multi-user machine there are many users with many cron entries!

Any thoughts welcome!

   -- Martin