Table of Contents

Module: ZService Zope-2.2.1-src/ZServer/ZService.py

ZServer as a NT service.

The serice starts up and monitors a ZServer process.

Features:

  • When you start the service it starts ZServer * When you stop the serivice it stops ZServer * It monitors ZServer and restarts it if it exits abnormally * If ZServer is shutdown from the web, the service stops. * If ZServer cannot be restarted, the service stops.

Usage:

Installation

The ZServer service should be installed by the Zope Windows installer. You can manually install, uninstall the service from the commandline.

ZService.py [options] install|update|remove|start [...] |stop|restart [...]|debug [...]

Options for install and update commands only:

--username domain\username : The Username the service is to run under

--password password : The password for the username

--startup [manual|auto|disabled] : How the service starts, default = manual

Commands

install : Installs the service

update : Updates the service, use this when you change ZServer.py

remove : Removes the service

start : Starts the service, this can also be done from the services control panel

stop : Stops the service, this can also be done from the services control panel

restart : Restarts the service

debug : Runs the service in debug mode

You can view the usage options by running ZServer.py without any arguments.

Note: you may have to register the Python service program first,

win32\pythonservice.exe /register

Starting Zope

Start Zope by clicking the start button in the services control panel. You can set Zope to automatically start at boot time by choosing Auto startup by clicking the statup button.

Stopping Zope

Stop Zope by clicking the stop button in the services control panel. You can also stop Zope through the web by going to the Zope control panel and by clicking Shutdown.

Event logging

Zope events are logged to the NT application event log. Use the event viewer to keep track of Zope events.

Registry Settings

You can change how the service starts ZServer by editing a registry key.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ \Parameters\start

The value of this key is the command which the service uses to start ZServer. For example:

      "C:\Program Files\Zope\bin\python.exe"
        "C:\Program Files\Zope\z2.py" -w 8888

TODO:

  • Integrate it into the Windows installer. * Add ZLOG logging in addition to event log logging. * Make it easier to run multiple Zope services with one Zope install

This script does for NT the same sort of thing zdaemon.py does for UNIX. Requires Python win32api extensions.

Imported modules   
import imp
import os
import string
import sys
import time
import win32api
import win32event
import win32process
import win32service
import win32serviceutil
Functions   
magic_import
set_start_command
  magic_import 
magic_import ( modulename,  filename )

  set_start_command 
set_start_command ( value )

sets the ZServer start command if the start command is not already set

Classes   
ZServerService

Table of Contents

This document was automatically generated on Mon Sep 4 07:33:06 2000 by HappyDoc version r0_6