mkzeowmp - zeo mount point para PZP (python, zope e plone)
Publicado por Ricardo Brito do Nascimento 28/10/2007
[ Hits: 5.250 ]
Homepage: http://brito.blog.incolume.com.br
Este script é responsável por criar uma instâcia mount point zeo para PZP, de maneira fácil e automatizada.
#!/bin/bash # # Make a new ZEO instance with mount points # and one client instance in the usual way; # mix in Plone products while at it. # # This should really be a Python script instead of bash. # Then the browser ID manager prefix could be modified and # the mount point folders created for total automation. # # usage: mkzeowmp instance_name \ # zeo_port \ # zclient_port_base \ # http_port \ # webdav_port \ # client_cpu_affinity \ # [list of mount point names separated by spaces]* # # v1.0 Chris Calloway June 15, 2006 # Copyright 2006 University of North Carolina at Chapel Hill # Department of Marine Science # All Rights Reserved # set -e PYTHON_BASE=/opt/Python-2.3.5 ZOPE_BASE=/opt/Zope-2.8.7 ZOPE_INSTANCES=/var/lib/Zope-2.8.7 ZOPE_MANAGER=zopemanager ZOPE_OWNER=zopeowner ZOPE_RUNNER=zoperunner ZEO_NAME=zeo ZCLIENT_NAME=zclient ZCLIENT_INSTANCE=0 PLONE_TARBALL_URI_PATH=http://plone.org/products/plone/releases/2.1.3/ PLONE_TARBALL_URI_FILE=Plone-2.1.3 PLONE_TARBALL_URI_EXT=.tar.gz if [ $(whoami) != ${ZOPE_MANAGER} ] then echo You must be the Zope code base manager in order to run this script. echo Also, never try to create Zope instances while root echo or your permissions will not work. exit 1 fi if [ ${#} -lt 6 ] then echo 'usage: mkzeowmp instance_name \' echo ' zeo_port \' echo ' zclient_port_base \' echo ' http_port \' echo ' webdav_port \' echo ' client_cpu_affinity \' echo ' [list of mount point names separated by spaces]*' exit 1 fi INSTANCE_NAME=${1} shift ZEO_PORT=${1} shift ZCLIENT_PORT_BASE=${1} shift HTTP_PORT=${1} shift WEBDAV_PORT=${1} shift CLIENT_CPU_AFFINITY=${1} shift count=$# i=0 while (( i < count )) do MOUNT_POINTS[ i++ ]=$1 shift done echo -n Please enter the Zope instance owner\'s password: stty_orig=$(stty -g) stty -echo read ZOPE_OWNER_PASSWORD stty $stty_orig echo echo -n Please enter the Zope instance owner\'s password again: stty_orig=$(stty -g) stty -echo read ZOPE_OWNER_PASSWORD_TEST stty $stty_orig echo if [ ${ZOPE_OWNER_PASSWORD} != ${ZOPE_OWNER_PASSWORD_TEST} ] then echo Sorry, the passwords do no match. Try again. exit 1 fi ${PYTHON_BASE}/bin/python ${ZOPE_BASE}/bin/mkzeoinstance.py \ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZEO_NAME} \ ${ZEO_PORT} ${PYTHON_BASE}/bin/python ${ZOPE_BASE}/bin/mkzopeinstance.py \ -d ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE} \ -u ${ZOPE_OWNER}:${ZOPE_OWNER_PASSWORD} chmod g+w ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZEO_NAME}/log/ \ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZEO_NAME}/var/ \ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/log/ \ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/var/ TEMPDIR=$(mktemp -d /tmp/${$}.XXXXXXXXXX) TEMP=${TEMPDIR}/${0}.${$} cat > ${TEMP} <<-EOF { s/\# user zope/user ${ZOPE_RUNNER}/ /<filestorage 1>/,/<\/filestorage>/c\\ EOF cat >> ${TEMP} <<-EOF <filestorage main>\\ path $(echo '$INSTANCE')/var/Data.fs\\ </filestorage>\\ EOF if [ ${#MOUNT_POINTS[0]} -gt 0 ] then for MOUNT_POINT in "${MOUNT_POINTS[@]}" do cat >> ${TEMP} <<-EOF <filestorage ${MOUNT_POINT}>\\ path $(echo '$INSTANCE')/var/$(echo ${MOUNT_POINT:0:1} | tr a-z A-Z )${MOUNT_POINT:1}.fs\\ </filestorage>\\ EOF done fi cat >> ${TEMP} <<-EOF } EOF sed -i -f ${TEMP} ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZEO_NAME}/etc/zeo.conf rm -rf ${TEMPDIR} TEMPDIR=$(mktemp -d /tmp/${$}.XXXXXXXXXX) TEMP=${TEMPDIR}/${0}.${$} cat > ${TEMP} <<-EOF { s/\# effective-user chrism/effective-user ${ZOPE_RUNNER}/ s/\# port-base 1000/port-base ${ZCLIENT_PORT_BASE}/ s/ address 8080/ address ${HTTP_PORT}/ s/\# <webdav-source-server>/<webdav-source-server>/ s/\# address 1980/ address ${WEBDAV_PORT}/ s/\# <\/webdav-source-server>/<\/webdav-source-server>/ s/\# <environment>/<environment>/ s/\# MY_PRODUCT_ENVVAR foobar/ ZOPE_PROCESS_AFFINITY ${CLIENT_CPU_AFFINITY}/ s/\# <\/environment>/<\/environment>/ /$(echo '^')<zodb_db main>/,/$(echo '^')<\/zodb_db>/s/$(echo '^')/# /g $(echo '$a')\\ EOF cat >> ${TEMP} <<-EOF <zodb_db main>\\ mount-point /\\ # ZODB cache, in number of objects\\ cache-size 5000\\ <zeoclient>\\ server localhost:${ZEO_PORT}\\ storage main\\ name mainzeostorage\\ var $(echo '$INSTANCE')/../${ZEO_NAME}/var\\ # ZEO client cache, in bytes\\ cache-size 20MB\\ # Uncomment to have a persistent disk cache\\ # client zeomain\\ </zeoclient>\\ </zodb_db>\\ EOF if [ ${#MOUNT_POINTS[0]} -gt 0 ] then for MOUNT_POINT in "${MOUNT_POINTS[@]}" do cat >> ${TEMP} <<-EOF <zodb_db ${MOUNT_POINT}>\\ mount-point /${MOUNT_POINT}\\ # ZODB cache, in number of objects\\ cache-size 5000\\ <zeoclient>\\ server localhost:${ZEO_PORT}\\ storage ${MOUNT_POINT}\\ name ${MOUNT_POINT}zeostorage\\ var $(echo '$INSTANCE')/../${ZEO_NAME}/var\\ # ZEO client cache, in bytes\\ cache-size 20MB\\ # Uncomment to have a persistent disk cache\\ # client zeo${MOUNT_POINT}\\ </zeoclient>\\ </zodb_db>\\ EOF done fi cat >> ${TEMP} <<-EOF } EOF sed -i -f ${TEMP} ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/etc/zope.conf rm -rf ${TEMPDIR} mv ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/Products/ \ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/ ln -sf ../Products/ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/Products cd ${ZOPE_INSTANCES}/${INSTANCE_NAME}/Products/ wget ${PLONE_TARBALL_URI_PATH}${PLONE_TARBALL_URI_FILE}${PLONE_TARBALL_URI_EXT} tar -xzvf ${PLONE_TARBALL_URI_FILE}${PLONE_TARBALL_URI_EXT} chown ${ZOPE_MANAGER}:${ZOPE_MANAGER} ${PLONE_TARBALL_URI_FILE} cd ${PLONE_TARBALL_URI_FILE} mv * .. cd .. rmdir ${PLONE_TARBALL_URI_FILE} ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZEO_NAME}/bin/runzeo & \ ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/bin/zopectl fg echo 'If there were no errors in the Zope logs, you may now run (as root):' echo echo ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZEO_NAME}/bin/zeoctl start echo then echo ${ZOPE_INSTANCES}/${INSTANCE_NAME}/${ZCLIENT_NAME}${ZCLIENT_INSTANCE}/bin/zopectl start echo echo login as ${ZOPE_OWNER}, change your browser ID manager prefix, and create your mount point folders. exit 0
Reconexão automática para internet ADSL
rc.mailMyIp - Informa seu IP externo para o Gmail
Instalando e configurando o AIDE em 15 minutos
Nenhum comentário foi encontrado.
Vou voltar moderar conteúdos de Dicas e Artigos (0)
Compartilhando a tela do Computador no Celular via Deskreen
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
Como renomear arquivos de letras maiúsculas para minúsculas
Imprimindo no formato livreto no Linux
Vim - incrementando números em substituição
Efeito "livro" em arquivos PDF
Como resolver o erro no CUPS: Unable to get list of printer drivers
Instalação Uefi com o instalador clássico do Mageia (1)
Vou voltar moderar conteúdos de Dicas e Artigos (0)
É cada coisa que me aparece! - não é só 3% (2)
[Python] Automação de scan de vulnerabilidades
[Python] Script para analise de superficie de ataque
[Shell Script] Novo script para redimensionar, rotacionar, converter e espelhar arquivos de imagem
[Shell Script] Iniciador de DOOM (DSDA-DOOM, Doom Retro ou Woof!)
[Shell Script] Script para adicionar bordas às imagens de uma pasta