Here are patches and documentation for using a single CUPS server for
multiple X2Go Server - very handy in highly virtualized environments.
It requires the shared database patch just sent to the list and the
database modifications contained in the VServer patches just posted.
The explanation is in the documentation.  Thanks - John
--- cups-x2go.conf.orig	2010-03-09 11:20:50.873606048 +0000
+++ cups-x2go.conf.new	2010-03-09 12:14:36.800611904 +0000
@@ -3,10 +3,42 @@
 ##
 
 ## Server with x2go system
-x2goserver = local
+#x2goserver = local
 
 ## dsa key for user x2goprint
 #printdsa = /root/.x2go/ssh/.x2goprint/id_dsa
 
 ## command to generate pdf files
 #ps2pdf = /usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f "%s"
+
+# Multi-X2Go Server options
+#==========================
+# Used when this print server must service multiple X2Go Servers
+# This requires a single database for all X2Go Server session data
+#multiserver = 0
+# Set multiserver to 0 (zero) to disable and 1 (one) to enable
+# defaults to 0
+
+#dbhost = localhost
+# Set dbhost to the name of the database host
+# defaults to localhost
+
+#dbuser = postgres
+# Set dbuser to the user ID for logging into the database
+# defaults to postgres
+
+#dbname = x2go_sessions
+# Set dbname to the database name
+# defaults to x2go_sessions
+
+#dbschema = 
+# Set dbschema to the master schema in a multi-schema X2Go database
+# This is the schema used to coordinate information from the individual
+# X2Go Server schemas in a secure environment (where one server cannot 
+# view another server's session data
+# defaults to an empty string
+
+#dbtable = sessions
+# Set dbtables to the database table used to hold the session data
+# defaults to sessions
+#==========================
--- cups-x2go.orig	2010-03-09 09:16:28.000000000 +0000
+++ cups-x2go	2010-04-06 11:36:58.566761342 +0000
@@ -26,6 +26,12 @@
 my $x2goserver = "local";
 my $printdsa = "/root/.x2go/ssh/.x2goprint/id_dsa";
 my $ps2pdf = "/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s.pdf\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f \"%s\"";
+my $multiserver=0;
+my $dbhost = "localhost";
+my $dbuser = "postgres";
+my $dbname = "x2go_sessions";
+my $dbschema = "";
+my $dbtable = "sessions";
 my $cfgfile="/etc/cups/cups-x2go.conf";
 my $userName;
 my @sessions;
@@ -60,8 +66,43 @@
          {
              $ps2pdf=$value;
          }
+         if($option eq "multiserver")
+         {
+           $multiserver = $value;
+         }
+         if($option eq "dbhost")
+         {
+           $dbhost=$value;
+         }
+         if($option eq "dbuser")
+         {
+           $dbuser=$value;
+         }
+         if($option eq "dbname")
+         {
+           $dbname=$value;
+         }
+         if($option eq "dbschema")
+         {
+           $dbschema=$value;
+           if($dbschema ne "")
+           {
+             $dbschema="$dbschema.";
+           } 
+         }
+         if($option eq "dbtable")
+         {
+           $dbtable=$value;
+         }         
      }
      close(CFG);
+     if ($multiserver)
+     {
+       $x2goserver=`echo "select server from $dbschema$dbtable where uname='$userName' limit 1" | psql -U $dbuser -h $dbhost -t $dbname`;
+       chomp($x2goserver);
+       chomp($x2goserver);
+       $x2goserver=~s/ //g;
+     }
  }
 }
 
@@ -119,7 +160,6 @@
     print STDERR "ERROR: Usage: cups-x2go job-id user title copies options [file]\n";
     exit 1;
 }
-
 my $jobID;
 my $jobTitle;
 my $copies;
@@ -128,7 +168,6 @@
 
 ($jobID, $userName, $jobTitle, $copies, $printOptions, $printFile) =  @ARGV;
 
-
 my $tempFile;
 if (!$printFile) 
 { 

Attachment: X2GoSharedCUPSServer.odt
Description: application/vnd.oasis.opendocument.text

_______________________________________________
X2go-dev mailing list
X2go-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/x2go-dev

Reply via email to