On 3/1/11 3:10 PM, Martin Koegler wrote:
> I had the same problem long ago, I modifed the vncserver script this way:
> 
> system("($vncStartup ; $0 -kill :$displayNumber )>> " . 
> &quotedString($desktopLog) . " 2>&1 &") if ($vncStartup);
> 
> The change is minimal and it does not change the function/parameters of 
> vncserver
> [except, that Xvnc is killed, after the session/window manager exits].

I believe that both approaches are beneficial.  The -fg switch is, as
previously mentioned, necessary in a grid environment.  The combined
patch which I've personally tested is attached.
Index: unix/vncserver
===================================================================
--- unix/vncserver      (revision 4305)
+++ unix/vncserver      (working copy)
@@ -122,7 +122,7 @@
 # Check command line options
 
 &ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1,
-             "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0);
+             "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0,"-fg",0);
 
 &Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'});
 
@@ -306,7 +306,15 @@
 }
 $ENV{VNCDESKTOP}= $desktopName;
 
-system("$vncUserDir/xstartup >> " . &quotedString($desktopLog) . " 2>&1 &");
+if ($opt{'-fg'}) {
+    system("$vncUserDir/xstartup >> " . &quotedString($desktopLog) . " 2>&1");
+    if (kill 0, `cat $pidFile`) {
+        $opt{'-kill'} = ':'.$displayNumber;
+        &Kill();
+    }
+} else {
+    system("($vncUserDir/xstartup; $0 -kill :$displayNumber) >> " . 
&quotedString($desktopLog) . " 2>&1 &");
+}
 
 exit;
 
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to