[Zope] start script for freebsd?

Paul Horbal horbal@atips.ca
Wed, 15 Aug 2001 20:26:01 -0600


This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C125C8.8034DEC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Shaun,

I don't have a freebsd box handy, but my guess is that you need to do a 'man
case' in FreeBSD and doublecheck the case syntax in your script.

It's probably something as simple as removing the " or changing "in" to
":"...

hth,
Paul.
  -----Original Message-----
  From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of vertigo
  Sent: August 15, 2001 19:52
  To: zope@zope.org
  Subject: [Zope] start script for freebsd?


  Hello everyone,

      i am wondering if there is anyone out there that might be able to
assist me in setting up a script to run Zope2.3.3 as a daemon on my
freeBSD4.2 server.  I have started with the redhat script by Markoer, and
have simply edited the paths to reflect correctly as to my directory
structure.  when i attempt to execute the script from shell by typing
"/usr/local/etc/rc.d/zope.sh restart", it returns "case: Too many
arguements".  this occurs with any arguement that i issue, even none..  when
the server is booting, and it is starting local packages, it echos
"echo_success: not found".  below is the content of the script:

  -=-=-=-=-
  case "$1" in
    start)
     # Check if zope is already running
     if [ ! -f /var/lock/subsys/zope ] ; then
        echo -n 'Starting zope daemon: '
        /usr/local/zope/Zope-2.3.3-src/start 2> /dev/null
        i=0
        while [ $i -lt 90 ]; do
           [ -f /usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] && break
           sleep 1 && echo -n "."
           let i=i+1
        done
        if [ $i -ge 90 ] ; then
           echo "Time out."
           exit 1
        else
           cat /usr/local/zope/Zope-2.3.3-src/var/Z2.pid >
/var/lock/subsys/zope
           touch /var/lock/subsys/zope
           cat /usr/local/zope/Zope-2.3.3-src/var/Z2.pid > /var/run/zope.pid
           touch /var/run/zope
           echo " OK"
        fi
     else
        echo "zope already running."
     fi
     echo
     ;;
    stop)
     echo -n 'Stopping zope daemon: '
     [ -f /usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] && kill `cat
/home/zope/zope/var/Z2.pid`
        rm -f /var/lock/subsys/zope
        rm -f /usr/local/zope/Zope-2.3.3-src/var/Z2.pid
        rm -f /usr/local/zope/Zope-2.3.3-src/var/pcgi.soc
        rm -f /usr/local/zope/Zope-2.3.3-src/var/Data.fs.lock
        rm -f /usr/local/zope/Zope-2.3.3-src/var/zProcessManager.pid
        echo " OK"
     echo
     ;;
    reload|restart)
     $0 stop
     $0 start
     ;;
    status)
     if [ -f /usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] ; then
       cat /usr/local/zope/Zope-2.3.3-src/var/Z2.pid > /var/lock/subsys/zope
       touch /var/lock/subsys/zope
       cat /usr/local/zope/Zope-2.3.3-src/var/Z2.pid > /var/run/zope.pid
       touch /var/run/zope
       echo "zope (pid `head -1 /var/run/zope.pid`) is running..."
     else
       echo "zope not running."
     fi
     ;;
    *)
     echo "Usage: /usr/local/etc/rc.d/zope.sh
{start|stop|restart|reload|status}"
     exit 1
  esac
  -=-=-=-=-

  note that /var/lock/subsys doesn't exist by default on freeBSD, so for
ease of use, i added those directories myself (root owns them).  in saying
that, i can only wonder if this is a permission error, but im not sure...
the attribs of the script are 755, executable.

  Thank you,
  Shaun

------=_NextPart_000_0015_01C125C8.8034DEC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4616.200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D524392402-16082001>Shaun,=20
</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D524392402-16082001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D524392402-16082001>I=20
don't have a freebsd box handy, but my guess is that you need to do a =
'man case'=20
in FreeBSD and doublecheck the case syntax in your =
script.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D524392402-16082001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D524392402-16082001>It's=20
probably something as simple as removing the " or changing "in" to=20
":"...</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D524392402-16082001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D524392402-16082001>hth,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D524392402-16082001>Paul.</SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> =
zope-admin@zope.org=20
  [mailto:zope-admin@zope.org]<B>On Behalf Of =
</B>vertigo<BR><B>Sent:</B> August=20
  15, 2001 19:52<BR><B>To:</B> zope@zope.org<BR><B>Subject:</B> [Zope] =
start=20
  script for freebsd?<BR><BR></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Hello everyone,</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; i am wondering if =
there is=20
  anyone out there that might be able to assist me in setting up a =
script to run=20
  Zope2.3.3 as a daemon on my freeBSD4.2 server.&nbsp; I have started =
with the=20
  redhat script by Markoer, and have simply edited the paths to reflect=20
  correctly as to my directory structure.&nbsp; when i attempt to =
execute the=20
  script from shell by typing "/usr/local/etc/rc.d/zope.sh restart", it =
returns=20
  "case: Too many arguements".&nbsp; this occurs with any arguement that =
i=20
  issue, even none..&nbsp; when the server is booting, and it is =
starting local=20
  packages, it echos "echo_success: not found".&nbsp; below is the =
content of=20
  the script:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-=3D-=3D-=3D-=3D-</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>case "$1" in<BR>&nbsp; =
start)<BR>&nbsp;&nbsp; #=20
  Check if zope is already running<BR>&nbsp;&nbsp; if [ ! -f=20
  /var/lock/subsys/zope ] ; then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo =
-n=20
  'Starting zope daemon: '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  /usr/local/zope/Zope-2.3.3-src/start 2&gt;=20
  /dev/null<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  i=3D0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while [ $i -lt 90 ];=20
  do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ -f=20
  /usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] &amp;&amp;=20
  break<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep 1 =
&amp;&amp;=20
  echo -n "."<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; let=20
  i=3Di+1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
done<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  if [ $i -ge 90 ] ; =
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  echo "Time out."<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
exit=20
  1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cat=20
  /usr/local/zope/Zope-2.3.3-src/var/Z2.pid &gt;=20
  =
/var/lock/subsys/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
  touch=20
  =
/var/lock/subsys/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 cat=20
  /usr/local/zope/Zope-2.3.3-src/var/Z2.pid &gt;=20
  /var/run/zope.pid<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
touch=20
  /var/run/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo =
"=20
  OK"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi<BR>&nbsp;&nbsp;=20
  else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "zope already=20
  running."<BR>&nbsp;&nbsp; fi<BR>&nbsp;&nbsp; echo<BR>&nbsp;&nbsp; =
;;<BR>&nbsp;=20
  stop)<BR>&nbsp;&nbsp; echo -n 'Stopping zope daemon: '<BR>&nbsp;&nbsp; =
[ -f=20
  /usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] &amp;&amp; kill `cat=20
  /home/zope/zope/var/Z2.pid`<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rm -f=20
  /var/lock/subsys/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rm -f=20
  =
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; rm=20
  -f=20
  =
/usr/local/zope/Zope-2.3.3-src/var/pcgi.soc<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
  rm -f=20
  =
/usr/local/zope/Zope-2.3.3-src/var/Data.fs.lock<BR>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
  rm -f=20
  =
/usr/local/zope/Zope-2.3.3-src/var/zProcessManager.pid<BR>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
  echo " OK"<BR>&nbsp;&nbsp; echo<BR>&nbsp;&nbsp; ;;<BR>&nbsp;=20
  reload|restart)<BR>&nbsp;&nbsp; $0 stop<BR>&nbsp;&nbsp; $0=20
  start<BR>&nbsp;&nbsp; ;;<BR>&nbsp; status)<BR>&nbsp;&nbsp; if [ -f=20
  /usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] ; =
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
  cat /usr/local/zope/Zope-2.3.3-src/var/Z2.pid &gt;=20
  /var/lock/subsys/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp; touch=20
  /var/lock/subsys/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp; cat=20
  /usr/local/zope/Zope-2.3.3-src/var/Z2.pid &gt;=20
  /var/run/zope.pid<BR>&nbsp;&nbsp;&nbsp;&nbsp; touch=20
  /var/run/zope<BR>&nbsp;&nbsp;&nbsp;&nbsp; echo "zope (pid `head -1=20
  /var/run/zope.pid`) is running..."<BR>&nbsp;&nbsp;=20
  else<BR>&nbsp;&nbsp;&nbsp;&nbsp; echo "zope not =
running."<BR>&nbsp;&nbsp;=20
  fi<BR>&nbsp;&nbsp; ;;<BR>&nbsp; *)<BR>&nbsp;&nbsp; echo "Usage:=20
  /usr/local/etc/rc.d/zope.sh=20
  {start|stop|restart|reload|status}"<BR>&nbsp;&nbsp; exit=20
1<BR>esac</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>-=3D-=3D-=3D-=3D-</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>note that /var/lock/subsys doesn't =
exist by=20
  default on freeBSD, so for ease of use, i added those directories =
myself (root=20
  owns them).&nbsp; in saying that, i can only wonder if this is a =
permission=20
  error, but im not sure...&nbsp; the attribs of the script are 755,=20
  executable.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Thank you,</FONT></DIV>
  <DIV><FONT face=3DArial =
size=3D2>Shaun</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0015_01C125C8.8034DEC0--