Odp: [Zope] strategies for starting zope on redhat
Hello
A friend reports he cannot start zope automatically at boot on his new Linux RedHat installation, but that it works fine when he does it manually from shell prompt.
Q1. Does anyone have any similar experience or advice about self-starting zope?
Q2. Does anyone have a nice approach to make sure Zope re-starts if it shutdown remotely for whatever reason?
I am sorry I do not have more precise details of his problem..
tia - Jason
Maybe following way will be helpful for you and others ?. You need place .zope_autostart script (attached below) in your home directory (don't forget make this as exetutable :). Also in your crontab file you need place a line (through command: crontab -e) like this: 0,minutes_between_checks * * * * /home/your_home/.zope_autostart zope_dir notify_email eg: 0,30 * * * * /home/jasonic/.zope_autostart /home/jasonic/Zope jasonic@nomadicsltd.com For me, works well. PS: I'am not good familiar with Linux (ang English lang too...) and you must ask anyone else if you would have troubles with access to crontab, advanced Linux configurations etc... Regards Adam Karpierz karpierz@itl.pl Filename .zope_autostart ======beg code======== #! /bin/sh ZOPEDIR="$1" INFOMAIL="$2" STARTFILE="$ZOPEDIR/start" STOPFILE="$ZOPEDIR/stop" PIDFILE="$ZOPEDIR/var/Z2.pid" PID1ACTIVE=0 PID2ACTIVE=0 if [ -x $STARTFILE ]; then if [ -r $PIDFILE ]; then PID1=`cut -d" " -f1 $PIDFILE` PID2=`cut -d" " -f2 $PIDFILE` if ps -p $PID1 >/dev/null 2>&1 then PID1ACTIVE=1 fi if ps -p $PID2 >/dev/null 2>&1 then PID2ACTIVE=1 fi fi if [ $PID1ACTIVE -eq 0 -o $PID2ACTIVE -eq 0 ]; then $STOPFILE >/dev/null 2>&1 sleep 10 $STARTFILE date | mail -s"Zope restarted" $INFOMAIL >/dev/null 2>&1 fi fi =======end code======
Adam Karpierz wrote:
Hello
A friend reports he cannot start zope automatically at boot on his new Linux RedHat installation, but that it works fine when he does it manually from shell prompt.
I have a sneaky suspicion he is tryign to call start form outside of the ZopeHome directory, and the start file is using relative paths. Answer: have the script first cd to the ZopeHome dir, or change the relativ epaths to absolutes.
Q1. Does anyone have any similar experience or advice about self-starting zope?
Q2. Does anyone have a nice approach to make sure Zope re-starts if it shutdown remotely for whatever reason?
Consult the script In your start file, add '-Z var/zserver.pid' to the startup options,
I've attached a startup script that I use on my RedHat 6.2 installation. You'll want to change the path /stor/zope/current to the directory where you have Zope installed. That probably should have been a variable. The Zope process will be owned as "nobody" so that user needs write permission to the var directory and its contents to create PID files and update the Data.fs. Install the file to /etc/rc.d/init.d as "zope" and then you can use linuxconf to control whether or not the "zope" service is started when the system boots. One other thing -- You have to make sure that the server does not run in debug mode (by passing -D to z2.py in the start script), or your boot sequence will hang. Doug Bill Anderson wrote:
Adam Karpierz wrote:
Hello
A friend reports he cannot start zope automatically at boot on his new Linux RedHat installation, but that it works fine when he does it manually from shell prompt.
-- Doug Hellmann Director of Portal Development ZapMedia.com 678.420.2744 #!/bin/sh # # Startup script for the Zope Application Server # # chkconfig: 345 85 15 # description: Zope is a web-based Application server. # processname: z2.py # pidfile: /stor/zope/current/var/Z2.pid # config: /stor/zope/current/var/Data.fs # Source function library. . /etc/rc.d/init.d/functions # See how we were called. case "$1" in start) echo -n "Starting zope: " daemon /stor/zope/current/start echo touch /var/lock/subsys/zope ;; stop) echo -n "Shutting down zope: " #killproc httpd /stor/zope/current/stop echo rm -f /var/lock/subsys/zope rm -f /stor/zope/current/var/Z2.pid ;; status) status z2.py ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0
participants (3)
-
Adam Karpierz -
Bill Anderson -
Doug Hellmann