Zope自動起動の設定
Zopeをソースからインストールしたときの自動起動設定方法
出典元:「Knowledge of Informational Engineers in Kyoto University.」
- /etc/init.d/zope として以下の起動用シェルスクリプト を作成します。:
シェルスクリプト #!/bin/sh # # zope Start/Stop the Zope web-application server. # # chkconfig: 2345 73 73 # description: zope is a web server specifically for handling \ # HTTP requests to the Zope web-application service. # # Source function library. . /etc/rc.d/init.d/functions # INSTANCE_HOME=/var/lib/zope INSTANCE_NAME=`basename ${INSTANCE_HOME}` RETVAL=0 [ -f ${INSTANCE_HOME}/bin/zopectl ] || exit 0 # case "$1" in start) echo -n "Starting zope: " umask 077 ${INSTANCE_HOME}/bin/zopectl start > /dev/null 2>&1 RETVAL=$? [ $RETVAL -eq 0 ] && success || failure echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/${INSTANCE_NAME} ;; stop) echo -n "Shutdown zope: " ${INSTANCE_HOME}/bin/zopectl stop > /dev/null 2>&1 RETVAL=$? [ $RETVAL -eq 0 ] && success || failure echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${INSTANCE_NAME} ;; restart|reload) $0 stop $0 start RETVAL=$? ;; condrestart) [ -f /var/lock/subsys/${INSTANCE_NAME} ] && $0 restart || RETVAL=0 ;; status) ${INSTANCE_HOME}/bin/zopectl status [ $RETVAL -ne 0 ] && RETVAL=$? ;; *) echo "Usage: zope {start|stop|restart|condrestart|status}" exit 1 esac # exit $RETVAL - マシン起動時に自動起動されるように設定する。:
# chown root:root /etc/init.d/zope # chmod 755 /etc/init.d/zope # /sbin/chkconfig --add zope # /usr/sbin/ntsysv <-- 自動起動サービスとしてチェックされてなければチェックする。Vine2.6などで起動できない場合は、次のようにしてみる。 # cgkconfig --list | grep 5:on で確認して、リストになければ # chkconfig zope on
- 手操作での起動と停止:
# /sbin/service zope [start | stop | restart | status | condrestart]
- Zope設定ファイル(/var/lib/zope/etc/zope.conf)に実効ユーザ(zope)を指定する。
変更前:
# Directive: effective-user # # Description: # If you intend to run Zope as the "root" user, you must supply this # directive with an effective username or userid number to which Zope # will 'suid' after the server ports are bound. This directive only # has effect under UNIX and if Zope is started as the root user. # # Default: unset # # Example: # # effective-user chrism
変更後:
# Directive: effective-user # # Description: # If you intend to run Zope as the "root" user, you must supply this # directive with an effective username or userid number to which Zope # will 'suid' after the server ports are bound. This directive only # has effect under UNIX and if Zope is started as the root user. # # Default: unset # # Example: # # effective-user chrism # Papasan added. effective-user zope <-- この1行を追記する。