[zopeorg-checkins] CVS: NZO_SiteLayout/bin - zopectl.in:1.3
Tres Seaver
tseaver at zope.com
Sun Apr 14 14:53:27 EDT 2002
Update of /cvs-zopeorg/NZO_SiteLayout/bin
In directory cvs.zope.org:/tmp/cvs-serv29059/bin
Modified Files:
zopectl.in
Log Message:
- Improve usage text.
- Re-order _ZopeCtl methods, grouping "commands" together at top of class,
and "helpers" at the bottom.
- Fix '_ZopeCtlCmd.usage' to delegate management of filename to engine.
=== NZO_SiteLayout/bin/zopectl.in 1.2 => 1.3 === (428/528 lines abridged)
Commands:
- help [command]
+ help [<command>]
start
stop
restart
logrotate
status
- show
- run
+ show [<info>*]
+ run <script_filename>
debug
If no commands supplied, runs as an interactive read-eval-print
@@ -55,10 +55,245 @@
def __init__( self, reporter ):
self._reporter = reporter
+ #
+ # Command implementation
+ #
+ def start( self, arg ):
+ """
+ Start the Zope appserver.
+ """
+ # XXX: We currently do this by using os.system to run z2.py;
+ # a better implementation would just fork and start
+ # Zope using config file info.
+
+ self._setupEnvironment( with_stupid_log=1 )
+
+ import sys
+ cmdline = '%s %s/z2.py %s %s' % ( sys.executable
+ , self._env[ 'ZOPE_HOME' ]
+ , self._buildCommandLine()
+ , arg
+ )
+
+ self._doSystem( 'Starting Zope', cmdline )
+
+ def restart( self, arg ):
+ """
+ Restart the Zope appserver.
+ """
+ self.stop( 'TERM' )
+ self.start( arg )
+
+ def logrotate( self, arg=None ):
[-=- -=- -=- 428 lines omitted -=- -=- -=-]
-
- if ( whatsit.get( 'env' )
- or whatsit.get( 'opts' )
- or whatsit.get( 'storage' )
- or whatsit.get( 'command-line' )
- ):
- self._loadConfigFile(1)
-
- if whatsit.get( 'python' ):
- self._showPython()
-
- if whatsit.get( 'config-file' ):
- self._showConfigFile()
-
- if whatsit.get( 'env' ):
- self._showEnv()
-
- if whatsit.get( 'opts' ):
- self._showOpts()
-
- if whatsit.get( 'storage' ):
- self._showStorage()
-
- if whatsit.get( 'command-line' ):
- self._showCommandLine()
-
- self._showFooter()
-
#
# Read-eval-print interpreter
#
@@ -584,7 +593,8 @@
import sys
- self._report( USAGE % { 'config_file' : self._config_file } )
+ self._report( USAGE % { 'config_file'
+ : self._engine._getConfigFile() } )
sys.exit( 2 )
@@ -602,7 +612,7 @@
for k, v in options:
if k == '--config':
- self._config_file = os.path.normpath( v )
+ self._engine._setConfigFile( os.path.normpath( v ) )
else:
usage()
More information about the zopeorg-checkins
mailing list