1: # server.tcl -- 2: 3: # This is a server that is detached from the main Apache process, in 4: # order to provide inter-process comunication via tcllib's comm 5: # package. 6: 7: # Copyright 2003-2004 The Apache Software Foundation 8: 9: # Licensed under the Apache License, Version 2.0 (the "License"); 10: # you may not use this file except in compliance with the License. 11: # You may obtain a copy of the License at 12: 13: # http://www.apache.org/licenses/LICENSE-2.0 14: 15: # Unless required by applicable law or agreed to in writing, software 16: # distributed under the License is distributed on an "AS IS" BASIS, 17: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18: # See the License for the specific language governing permissions and 19: # limitations under the License. 20: 21: # $Id: server.tcl,v 1.5 2004/02/24 10:24:32 davidw Exp $ 22: 23: # TODO: 24: # Add some code for serializing variables between sessions. 25: # Possibilities for keeping sync'ed include: catching signals and 26: # shutting down gracefully, or periodically saving to disk. 27: 28: package require comm 29: 30: set Port [lindex $argv 0] 31: if { [catch { 32: comm::comm config -port $Port 33: } err] } { 34: # Ok, something failed. This should mean that another copy is 35: # already running. 36: puts stderr "Could not launch commserver on port $Port, exiting" 37: exit 1 38: } else { 39: puts stderr "Launched commserver on port $Port" 40: vwait forever 41: } |