[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> </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> </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> </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> </DIV>
<DIV><FONT face=3DArial size=3D2> 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. 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. 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". this occurs with any arguement that =
i=20
issue, even none.. when the server is booting, and it is =
starting local=20
packages, it echos "echo_success: not found". below is the =
content of=20
the script:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>-=3D-=3D-=3D-=3D-</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>case "$1" in<BR> =
start)<BR> #=20
Check if zope is already running<BR> if [ ! -f=20
/var/lock/subsys/zope ] ; then<BR> echo =
-n=20
'Starting zope daemon: '<BR> =20
/usr/local/zope/Zope-2.3.3-src/start 2>=20
/dev/null<BR> =20
i=3D0<BR> while [ $i -lt 90 ];=20
do<BR> [ -f=20
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] &&=20
break<BR> sleep 1 =
&&=20
echo -n "."<BR> let=20
i=3Di+1<BR> =
done<BR> =20
if [ $i -ge 90 ] ; =
then<BR> =20
echo "Time out."<BR> =
exit=20
1<BR> =20
else<BR> cat=20
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid >=20
=
/var/lock/subsys/zope<BR> =
=20
touch=20
=
/var/lock/subsys/zope<BR> =
cat=20
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid >=20
/var/run/zope.pid<BR> =
touch=20
/var/run/zope<BR> echo =
"=20
OK"<BR> fi<BR> =20
else<BR> echo "zope already=20
running."<BR> fi<BR> echo<BR> =
;;<BR> =20
stop)<BR> echo -n 'Stopping zope daemon: '<BR> =
[ -f=20
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] && kill `cat=20
/home/zope/zope/var/Z2.pid`<BR> rm -f=20
/var/lock/subsys/zope<BR> rm -f=20
=
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid<BR> &nbs=
p; rm=20
-f=20
=
/usr/local/zope/Zope-2.3.3-src/var/pcgi.soc<BR> &n=
bsp;=20
rm -f=20
=
/usr/local/zope/Zope-2.3.3-src/var/Data.fs.lock<BR> &nbs=
p; =20
rm -f=20
=
/usr/local/zope/Zope-2.3.3-src/var/zProcessManager.pid<BR> &nb=
sp; =20
echo " OK"<BR> echo<BR> ;;<BR> =20
reload|restart)<BR> $0 stop<BR> $0=20
start<BR> ;;<BR> status)<BR> if [ -f=20
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid ] ; =
then<BR> =20
cat /usr/local/zope/Zope-2.3.3-src/var/Z2.pid >=20
/var/lock/subsys/zope<BR> touch=20
/var/lock/subsys/zope<BR> cat=20
/usr/local/zope/Zope-2.3.3-src/var/Z2.pid >=20
/var/run/zope.pid<BR> touch=20
/var/run/zope<BR> echo "zope (pid `head -1=20
/var/run/zope.pid`) is running..."<BR> =20
else<BR> echo "zope not =
running."<BR> =20
fi<BR> ;;<BR> *)<BR> echo "Usage:=20
/usr/local/etc/rc.d/zope.sh=20
{start|stop|restart|reload|status}"<BR> exit=20
1<BR>esac</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-=3D-=3D-=3D-=3D-</FONT></DIV>
<DIV> </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). in saying that, i can only wonder if this is a =
permission=20
error, but im not sure... the attribs of the script are 755,=20
executable.</FONT></DIV>
<DIV> </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--