[Zope-Checkins] CVS: Zope/inst/skel/inst/skel/bin - ntservice.py:1.1.2.2
Guido van Rossum
guido@python.org
Wed, 9 Oct 2002 11:37:40 -0400
Update of /cvs-repository/Zope/inst/skel/inst/skel/bin
In directory cvs.zope.org:/tmp/cvs-serv29313/inst/skel/inst/skel/bin
Modified Files:
Tag: chrism-install-branch
ntservice.py
Log Message:
Fix CRLF line endings. Do your checkouts on Windows.
=== Zope/inst/skel/inst/skel/bin/ntservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope/inst/skel/inst/skel/bin/ntservice.py:1.1.2.1 Sun Oct 6 17:42:52 2002
+++ Zope/inst/skel/inst/skel/bin/ntservice.py Wed Oct 9 11:37:09 2002
@@ -1,79 +1,79 @@
-##############################################################################
-#
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
-#
-##############################################################################
-"""
-
-Installs, removes, stops, and starts a Windows NT service related to the
-Zope instance home in which it's installed.
-
-"""
-import zctl
-from Controller.NTService import NTService
-import win32serviceutil
-import win32api
-import os, sys
-
-# assumes zctl is in bin dir of instance home
-dn = os.path.dirname
-
-instance = os.path.abspath(dn(dn(zctl.__file__)))
-
-servicename = os.path.splitdrive(instance)[1]
-servicename = servicename.replace("\\", '_')
-servicename = servicename.replace(" ", "_")
-if servicename.startswith('_'):
- servicename = servicename[1:]
-servicename = 'Zope_%s' % servicename
-
-class InstanceService(NTService):
- _svc_name_ = servicename
- _svc_display_name_ = 'Zope instance at %s' % instance
-
- def get_start_command(self):
- os.chdir(instance) # hack, but required for successful service start
- return win32serviceutil.GetServiceCustomOption(self,'start')
-
- def get_stop_command(self):
- os.chdir(instance) # hack, but required for successful service stop
- return win32serviceutil.GetServiceCustomOption(self,'stop')
-
-def usage():
- print __doc__
-
-def set_start_command(value):
- "sets the ZServer start command if the start command is not already set"
- current=win32serviceutil.GetServiceCustomOption(InstanceService,
- 'start', None)
- if current is None:
- win32serviceutil.SetServiceCustomOption(InstanceService,'start',value)
-
-def set_stop_command(value):
- "sets the stop command if the stop command is not already set"
- current=win32serviceutil.GetServiceCustomOption(InstanceService,
- 'stop', None)
- if current is None:
- win32serviceutil.SetServiceCustomOption(InstanceService,'stop',value)
-
-if __name__ == '__main__':
- win32serviceutil.HandleCommandLine(InstanceService)
- if 'install' in sys.argv:
- python = win32api.GetShortPathName(sys.executable)
- zctl = zctl.__file__
- if zctl[-3:] in ('pyc', 'pyo'):
- zctl = zctl[:-1]
- cmd = win32api.GetShortPathName(zctl)
- start_command="%s %s start" % (python, cmd)
- stop_command ="%s %s stop" % (python, cmd)
- set_start_command(start_command)
- set_stop_command(stop_command)
- print "Setting Zope instance start command to:", start_command
- print "Setting Zope instance stop command to:", stop_command
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+"""
+
+Installs, removes, stops, and starts a Windows NT service related to the
+Zope instance home in which it's installed.
+
+"""
+import zctl
+from Controller.NTService import NTService
+import win32serviceutil
+import win32api
+import os, sys
+
+# assumes zctl is in bin dir of instance home
+dn = os.path.dirname
+
+instance = os.path.abspath(dn(dn(zctl.__file__)))
+
+servicename = os.path.splitdrive(instance)[1]
+servicename = servicename.replace("\\", '_')
+servicename = servicename.replace(" ", "_")
+if servicename.startswith('_'):
+ servicename = servicename[1:]
+servicename = 'Zope_%s' % servicename
+
+class InstanceService(NTService):
+ _svc_name_ = servicename
+ _svc_display_name_ = 'Zope instance at %s' % instance
+
+ def get_start_command(self):
+ os.chdir(instance) # hack, but required for successful service start
+ return win32serviceutil.GetServiceCustomOption(self,'start')
+
+ def get_stop_command(self):
+ os.chdir(instance) # hack, but required for successful service stop
+ return win32serviceutil.GetServiceCustomOption(self,'stop')
+
+def usage():
+ print __doc__
+
+def set_start_command(value):
+ "sets the ZServer start command if the start command is not already set"
+ current=win32serviceutil.GetServiceCustomOption(InstanceService,
+ 'start', None)
+ if current is None:
+ win32serviceutil.SetServiceCustomOption(InstanceService,'start',value)
+
+def set_stop_command(value):
+ "sets the stop command if the stop command is not already set"
+ current=win32serviceutil.GetServiceCustomOption(InstanceService,
+ 'stop', None)
+ if current is None:
+ win32serviceutil.SetServiceCustomOption(InstanceService,'stop',value)
+
+if __name__ == '__main__':
+ win32serviceutil.HandleCommandLine(InstanceService)
+ if 'install' in sys.argv:
+ python = win32api.GetShortPathName(sys.executable)
+ zctl = zctl.__file__
+ if zctl[-3:] in ('pyc', 'pyo'):
+ zctl = zctl[:-1]
+ cmd = win32api.GetShortPathName(zctl)
+ start_command="%s %s start" % (python, cmd)
+ stop_command ="%s %s stop" % (python, cmd)
+ set_start_command(start_command)
+ set_stop_command(stop_command)
+ print "Setting Zope instance start command to:", start_command
+ print "Setting Zope instance stop command to:", stop_command