Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
8e51c8a8
Commit
8e51c8a8
authored
Apr 23, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The mkzeoinst script was fixed to tell people to
install and use the mkzeoinstance script. :)
parent
3bc0eafa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
224 deletions
+9
-224
src/CHANGES.txt
src/CHANGES.txt
+3
-0
src/ZEO/mkzeoinst.py
src/ZEO/mkzeoinst.py
+6
-224
No files found.
src/CHANGES.txt
View file @
8e51c8a8
...
...
@@ -16,6 +16,9 @@ Bugs Fixed
https://bugs.launchpad.net/zodb/+bug/544305
- The mkzeoinst script was fixed to tell people to
install and use the mkzeoinstance script. :)
3.9.4 (2009-12-14)
==================
...
...
src/ZEO/mkzeoinst.py
View file @
8e51c8a8
...
...
@@ -11,233 +11,15 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""%(program)s -- create a ZEO instance.
print
"""
The mkzeoinst script is no longer supported.
Usage: %(program)s home [port]
Install the zope.mkzeoinstance package:
Given an "instance home directory" <home> and some configuration
options (all of which have default values), create the following:
http://pypi.python.org/pypi/zope.mkzeoinstance
<home>/etc/zeo.conf -- ZEO config file
<home>/var/ -- Directory for data files: Data.fs etc.
<home>/log/ -- Directory for log files: zeo.log and zeoctl.log
<home>/bin/runzeo -- the zeo server runner
<home>/bin/zeoctl -- start/stop script (a shim for zeoctl.py)
The script will not overwrite existing files; instead, it will issue a
warning if an existing file is found that differs from the file that
would be written if it didn't exist.
and use the installed mkzeointance script that is installed by that package.
"""
# WARNING! Several templates and functions here are reused by ZRS.
# So be careful with changes.
import
os
import
sys
import
stat
import
getopt
zeo_conf_template
=
"""
\
# ZEO configuration file
%%define INSTANCE %(instance_home)s
<zeo>
address %(port)d
read-only false
invalidation-queue-size 100
# pid-filename $INSTANCE/var/ZEO.pid
# monitor-address PORT
# transaction-timeout SECONDS
</zeo>
<filestorage 1>
path $INSTANCE/var/Data.fs
</filestorage>
<eventlog>
level info
<logfile>
path $INSTANCE/log/zeo.log
</logfile>
</eventlog>
<runner>
program $INSTANCE/bin/runzeo
socket-name $INSTANCE/etc/%(package)s.zdsock
daemon true
forever false
backoff-limit 10
exit-codes 0, 2
directory $INSTANCE
default-to-interactive true
# user zope
python %(python)s
zdrun %(zodb3_home)s/zdaemon/zdrun.py
# This logfile should match the one in the %(package)s.conf file.
# It is used by zdctl's logtail command, zdrun/zdctl doesn't write it.
logfile $INSTANCE/log/%(package)s.log
</runner>
"""
zeoctl_template
=
"""
\
#!/bin/sh
# %(PACKAGE)s instance control script
# The following two lines are for chkconfig. On Red Hat Linux (and
# some other systems), you can copy or symlink this script into
# /etc/rc.d/init.d/ and then use chkconfig(8) to automatically start
# %(PACKAGE)s at boot time.
# chkconfig: 345 90 10
# description: start a %(PACKAGE)s server
PYTHON="%(python)s"
INSTANCE_HOME="%(instance_home)s"
ZODB3_HOME="%(zodb3_home)s"
CONFIG_FILE="%(instance_home)s/etc/%(package)s.conf"
PYTHONPATH="$ZODB3_HOME"
export PYTHONPATH INSTANCE_HOME
ZEOCTL="$ZODB3_HOME/ZEO/zeoctl.py"
exec "$PYTHON" "$ZEOCTL" -C "$CONFIG_FILE" ${1+"$@"}
"""
runzeo_template
=
"""
\
#!/bin/sh
# %(PACKAGE)s instance start script
PYTHON="%(python)s"
INSTANCE_HOME="%(instance_home)s"
ZODB3_HOME="%(zodb3_home)s"
CONFIG_FILE="%(instance_home)s/etc/%(package)s.conf"
PYTHONPATH="$ZODB3_HOME"
export PYTHONPATH INSTANCE_HOME
RUNZEO="$ZODB3_HOME/ZEO/runzeo.py"
exec "$PYTHON" "$RUNZEO" -C "$CONFIG_FILE" ${1+"$@"}
"""
def
main
():
ZEOInstanceBuilder
().
run
()
print
"All done."
class
ZEOInstanceBuilder
:
def
run
(
self
):
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"h"
,
[
"help"
])
except
getopt
.
error
,
msg
:
print
msg
sys
.
exit
(
2
)
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
if
opts
:
# There's only the help options, so just dump some help:
msg
=
__doc__
%
{
"program"
:
program
}
print
msg
sys
.
exit
()
if
len
(
args
)
not
in
[
1
,
2
]:
print
"Usage: %s home [port]"
%
program
sys
.
exit
(
2
)
instance_home
=
args
[
0
]
if
not
os
.
path
.
isabs
(
instance_home
):
instance_home
=
os
.
path
.
abspath
(
instance_home
)
for
entry
in
sys
.
path
:
if
os
.
path
.
exists
(
os
.
path
.
join
(
entry
,
'ZODB'
)):
zodb3_home
=
entry
break
else
:
print
"Can't find the Zope home (not in sys.path)"
sys
.
exit
(
2
)
if
args
[
1
:]:
port
=
int
(
args
[
1
])
else
:
port
=
8100
# match example in zope.conf
params
=
self
.
get_params
(
zodb3_home
,
instance_home
,
port
)
self
.
create
(
instance_home
,
params
)
def
get_params
(
self
,
zodb3_home
,
instance_home
,
port
):
return
{
"package"
:
"zeo"
,
"PACKAGE"
:
"ZEO"
,
"zodb3_home"
:
zodb3_home
,
"instance_home"
:
instance_home
,
"port"
:
port
,
"python"
:
sys
.
executable
,
}
def
create
(
self
,
home
,
params
):
makedir
(
home
)
makedir
(
home
,
"etc"
)
makedir
(
home
,
"var"
)
makedir
(
home
,
"log"
)
makedir
(
home
,
"bin"
)
makefile
(
zeo_conf_template
,
home
,
"etc"
,
"zeo.conf"
,
**
params
)
makexfile
(
zeoctl_template
,
home
,
"bin"
,
"zeoctl"
,
**
params
)
makexfile
(
runzeo_template
,
home
,
"bin"
,
"runzeo"
,
**
params
)
def
which
(
program
):
strpath
=
os
.
getenv
(
"PATH"
)
binpath
=
strpath
.
split
(
os
.
pathsep
)
for
dir
in
binpath
:
path
=
os
.
path
.
join
(
dir
,
program
)
if
os
.
path
.
isfile
(
path
)
and
os
.
access
(
path
,
os
.
X_OK
):
if
not
os
.
path
.
isabs
(
path
):
path
=
os
.
path
.
abspath
(
path
)
return
path
raise
IOError
(
"can't find %r on path %r"
%
(
program
,
strpath
))
def
makedir
(
*
args
):
path
=
""
for
arg
in
args
:
path
=
os
.
path
.
join
(
path
,
arg
)
mkdirs
(
path
)
return
path
def
mkdirs
(
path
):
if
os
.
path
.
isdir
(
path
):
return
head
,
tail
=
os
.
path
.
split
(
path
)
if
head
and
tail
and
not
os
.
path
.
isdir
(
head
):
mkdirs
(
head
)
os
.
mkdir
(
path
)
print
"Created directory"
,
path
def
makefile
(
template
,
*
args
,
**
kwds
):
path
=
makedir
(
*
args
[:
-
1
])
path
=
os
.
path
.
join
(
path
,
args
[
-
1
])
data
=
template
%
kwds
if
os
.
path
.
exists
(
path
):
f
=
open
(
path
)
olddata
=
f
.
read
().
strip
()
f
.
close
()
if
olddata
:
if
olddata
!=
data
.
strip
():
print
"Warning: not overwriting existing file %r"
%
path
return
path
f
=
open
(
path
,
"w"
)
f
.
write
(
data
)
f
.
close
()
print
"Wrote file"
,
path
return
path
def
makexfile
(
template
,
*
args
,
**
kwds
):
path
=
makefile
(
template
,
*
args
,
**
kwds
)
umask
=
os
.
umask
(
022
)
os
.
umask
(
umask
)
mode
=
0777
&
~
umask
if
stat
.
S_IMODE
(
os
.
stat
(
path
)[
stat
.
ST_MODE
])
!=
mode
:
os
.
chmod
(
path
,
mode
)
print
"Changed mode for %s to %o"
%
(
path
,
mode
)
return
path
sys
.
exit
(
1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment