Re: [Zope-dev] Re: SVN: Zope/trunk/ Support for using zopectl on Windows has been added.
Hanno Schlichting wrote: Hi. I have just recently been given zope.org SVN write access and made my first bigger change - making zopectl work on Windows. Please review and test my changes. The change I made is based on code that I had in the plone.recipe.zope2instance buildout recipe and has seen quite some use by various developers, so should be reasonable stable. Cool, I've been waiting for this for about 5 years ;-) Shame start and stop require Zope to be a service, does each Zope instance become a seperate service? Are there any problems with having lots of zope instances running as services on the same box? Do zopectl debug and zopectl test work? Which version of Zope will this land in? Or, and where are the tests? 0.8 wink) cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: SVN: Zope/trunk/ Support for using zopectl on Windows has been added.
Hi. Chris Withers wrote: Hanno Schlichting wrote: I have just recently been given zope.org SVN write access and made my first bigger change - making zopectl work on Windows. Please review and test my changes. The change I made is based on code that I had in the plone.recipe.zope2instance buildout recipe and has seen quite some use by various developers, so should be reasonable stable. Cool, I've been waiting for this for about 5 years ;-) I needed it three years ago and have finally found the time to write this, though I'm not developing on Windows anymore ;) Shame start and stop require Zope to be a service, does each Zope instance become a seperate service? Are there any problems with having lots of zope instances running as services on the same box? I think start/stop requiring a service is the only sane thing you can do on Windows, without rewriting the whole service concept - automatic starts at boot time, easy restarting, running as a separate user... Running multiple Zope instances on the same box has no problems I heard of so far or have been witnessing. Obviously they need to listen on their own distinct ports. Do zopectl debug and zopectl test work? Yes, as far as my testing suggests. Which version of Zope will this land in? I consider this a non-trivial change that changes a crucial part (a broken zopectl in a minor release would heart us) so I only committed it to the current trunk which will become Zope 2.11 one day I suppose. Or, and where are the tests? 0.8 wink) There aren't any for zopectl at all, so I haven't tried to come up with a way to write them specifically for Windows. My main problem here is, that I cannot think of any sane way to test starting a real Zope instance in a test environment. If somebody has ideas how to approach this, feel free to tell me ;) Hanno ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: SVN: Zope/trunk/ Support for using zopectl on Windows has been added.
Hi. I have just recently been given zope.org SVN write access and made my first bigger change - making zopectl work on Windows. Please review and test my changes. The change I made is based on code that I had in the plone.recipe.zope2instance buildout recipe and has seen quite some use by various developers, so should be reasonable stable. Hanno Hanno Schlichting wrote: Log message for revision 75066: Support for using zopectl on Windows has been added. All commands are supported and there are two Windows specific ones: install and remove, which install or remove the Windows service. The start, stop and restart commands handle the Windows service. Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/Zope2/Startup/zopectl.py A Zope/trunk/skel/bin/zopectl.bat.in -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt2007-05-03 18:27:55 UTC (rev 75065) +++ Zope/trunk/doc/CHANGES.txt2007-05-03 18:35:20 UTC (rev 75066) @@ -51,6 +51,12 @@ Features added + - Support for using zopectl on Windows has been added. All commands are +supported and there are two Windows specific ones: install and remove, +which install or remove the Windows service. The start, stop and +restart commands handle the Windows service. In order to use them, you +need to call 'bin\zopectl install' once. + - ZCatalog result objects (catalog brains) now have an interface, ZCatalog.interfaces.ICatalogBrain. Modified: Zope/trunk/lib/python/Zope2/Startup/zopectl.py === --- Zope/trunk/lib/python/Zope2/Startup/zopectl.py2007-05-03 18:27:55 UTC (rev 75065) +++ Zope/trunk/lib/python/Zope2/Startup/zopectl.py2007-05-03 18:35:20 UTC (rev 75066) @@ -48,6 +48,9 @@ from ZConfig.components.logger.handlers import FileHandlerFactory from ZConfig.datatypes import existing_dirpath +WIN = False +if sys.platform[:3].lower() == win: +WIN = True def string_list(arg): return arg.split() @@ -127,6 +130,12 @@ self.python = sys.executable self.zdrun = os.path.join(os.path.dirname(zdaemon.__file__), zdrun.py) +if WIN: +# Add the path to the zopeservice.py script, which is needed for +# some of the Windows specific commands +servicescript = os.path.join(self.directory, 'bin', 'zopeservice.py') +self.servicescript = '%s %s' % (self.python, servicescript) + self.exitcodes = [0, 2] if self.logfile is None and config.eventlog is not None: for handler in config.eventlog.handler_factories: @@ -158,11 +167,59 @@ args = [opt, svalue] return args +if WIN: +def get_status(self): +# get_status from zdaemon relies on *nix specific socket handling. +# We just don't support getting the status and sending actions to +# the control server on Windows. This could be extended to ask for +# the status of the Windows service though +self.zd_up = 0 +self.zd_pid = 0 +self.zd_status = None +return + +def do_stop(self, arg): +# Stop the Windows service +program = %s stop % self.options.servicescript +print program +os.system(program) + +def do_restart(self, arg): +# Restart the Windows service +program = %s restart % self.options.servicescript +print program +os.system(program) + +# Add extra commands to install and remove the Windows service + +def do_install(self, arg): +program = %s install % self.options.servicescript +print program +os.system(program) + +def help_install(self): +print install -- Installs Zope as a Windows service. + +def do_remove(self, arg): +program = %s remove % self.options.servicescript +print program +os.system(program) + +def help_remove(self): +print remove -- Removes the Zope Windows service. + def do_start(self, arg): # signal to Zope that it is being managed -#(to indicate it's web-restartable) +# (to indicate it's web-restartable) os.putenv('ZMANAGED', '1') -ZDCmd.do_start(self, arg) +if WIN: +# On Windows start the service, this fails with a reasonable +# error message as long as the service is not installed +program = %s start % self.options.servicescript +print program +os.system(program) +else: +
Re: [Zope-dev] Re: SVN: Zope/trunk/ Support for using zopectl on Windows has been added.
--On 3. Mai 2007 20:43:40 +0200 Hanno Schlichting [EMAIL PROTECTED] wrote: Hi. I have just recently been given zope.org SVN write access and made my first bigger change - making zopectl work on Windows. Although I don't care much about Windows, great job! Thanks! Andreas pgpxOKD5eI1nF.pgp Description: PGP signature ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )