Starting Zope Automatically
As expected, Apple uses a variant of the modern BSD startup system. However, instead of /usr/local/etc/rc.d/, user-defined startup scripts are located in /Library/StartupItems/. There are also other slight differences. Fortunately, I was not forced to learn these intricacies, because integrating Zope with it turned out to be fairly trivial.[6]
My strategy was to copy and paste the Apache startup folder and use that as an example:
cp -r /System/Library/StartupItems/Apache /Library/StartupItems/Zope cd /Library/StartupItems/Zope rm -r Resources mv Apache Zope edit Zope
Edit the shell script, trimming unnecessary conditions and converting from apachectl to zopectl. I've posted mine in an appendix. Then edit StartupProperties.plist. PropertyList is an Apple-specific format that has both XML and non-XML implementations. If your system is like mine, the Apache plist will be in non-XML format. Somewhere along the line I ended up switching to XML format while trying to get things to work. In the end I don't think it matters, but my example is in XML.
The last thing you need to do is to edit /etc/hostconfig, and append the following to the end of it:
ZOPESERVER=-YES-
I learned this critical tidbit from a random how-to on Apple.com (in the last paragraph). At first I thought the value of the Provides key in the plist file is what drives the service name in /etc/hostconfig. However, now I think that the hostconfig file provides context for the Zope startup script.[7] In any case, the files as described work for me.
After you edit these three files, bounce your server and see if Zope comes back up on reboot. If it does, then it is time to step back a bit and look at what we've done with the OS X filesystem.
Notes
[6] If you want to understand the system, as good a place to start as any is Start Me Up: Writing and Understanding OS X StartupItems from O'Reilly's Mac DevCenter. This tutorial is nearly great: he makes no mention of /etc/hostconfig, however.
[7] Incidentally, here's another place where the Darwin man pages let me down. Why no manual entry for hostconfig?
Possible/Likely Typo in Article @ /etc/hostconfig
NB that the /etc/hostconfig line cited as: ZOPESERVE=-YES- should probably be: ZOPESERVER=-YES-
Not that I have gotten it to work that way either...
-JK
and in leopard?
Successfully started Plone on Mac OS X Leopard
/Applications/Plone-3.0.5/Instance/bin/zopectl
Having put this script (called 'Zope') in a newly created /Library/StartupItems/Zope I had to change its permissions:
cd /Library/StartupItems/Zope
chmod a+x Zope
Your plist went in the same place, as you instructed, and the /etc/hostconfig edited as you indicated ... et voila!
One extra touch I had to make because I use port 8080, I edited /Applications/Plone-3.0.5/Instance/etc/zope.conf to give me another port.
supervise for osx?
how can i make sure that if zope crashes or any other problem accours that zope will be restarted? on bsd i use supervise. has macosx a similar machanisme?
thanx reco