[CalendarServer-users] How to install as system service?

Emil Lundberg Emil.Lundberg at bmc.uu.se
Wed Nov 7 13:31:25 PST 2007

Although I have yet to test this myself, I belive you're on the right  
track. Some advice:

-> The place to put contrib/calendarserver.plist is in /Library/ 
To actually start the service, use 'sudo launchctl load -x /Library/ 
This sets the Disabled key to </false> AND loads the service. See 'man  
launchctl' for further info.

-> The './run -i' does not seem to copy the conf/caldavd.plist to the  
default system location (nor any other conf files).
Try 'cp conf/caldavd-test.plist /etc/caldavd/caldavd.plist' and modify  
it to suit you needs.
If you want this plist in a different location, add this to  
ProgramArguments: <string>-f /path/to/caldavd.plist</string

-> Running as a non-root user is good security practice. There seems  
to be two ways of doing this; one is to add the '-u' and '-g'  
ProgramArguments to calenderserver.plist, and another is using the  
UserName/GroupName keys to caldavd.plist. The latter is used in iCS,  
yielding a master twistd process owned by root, and the rest owned by  
the user specified. Make sure you create the user first.

-> As you said, use 'sudo /usr/local/bin/caldavd -X [ -f  
<configfile ]' for debugging. The error message you see is twistd  
complaining about (lack of?) options, if you echo the last line in / 
usr/local/bin/caldavd (it's just a shell script), you can see what it  
tries to do, like so:

echo "${python} ${twistdpath} ${daemonize} ${username} ${groupname} $ 
{profile} ${plugin_name} ${configfile} ${service_type}"

This should yield something like:

(iCS system service):
Python.app/Contents/MacOS/Python /usr/share/caldavd/bin/twistd -n caldav

(DCS stand-alone):
Python.app/Contents/MacOS/Python /Install/DCS-1.0/Twisted/bin/twistd  
caldav -f /Install/DCS-1.0/CalendarServer-1.0/conf/caldavd-dev.plist - 
o ProcessType=Combined

Any improvement?


6 nov 2007 kl. 19.48 skrev Stonewall Ballard:

> I want to run CalendarServer on a non-server Leopard Mac. I've built  
> it and it works fine when run from my account. I didn't see any  
> instructions on installing it as a system service, but the run file  
> has an installation switch, so I installed it to /, which puts parts  
> in various, sensible places.
> In the contrib directory, there is a launchd/calendarserver.plist  
> file, which has different paths to the parts. I edited it and put it  
> in the right place, but it didn't work. I couldn't find any log of  
> why that was, so I tried running "sudo /usr/local/bin/caldavd -X"  
> from a terminal window, and got an error: "/usr/local/bin/twistd:  
> Wrong number of arguments". I can't tell from the caldavd or the  
> twistd file why this might be. I get this same error when running  
> caldavd from my build directory, but not if I run "run".
> I hope that an installer (or a MacPort) will be available soon, but  
> I'd like to know if this is supposed to work. The differences  
> between the launchd plist and the run install paths make me worry  
> that this is just incomplete.
> I also noted that somewhere it says to use user & group "calendar",  
> but I have not created those yet, if it matters. I'm just testing  
> caldavd with sudo.
> Can someone please tell me how to install and run CalendarServer as  
> a system service?
> Thanks very much.
> - Stoney
> -- 
> Stonewall Ballard
> stoney at sb.org           http://stoney.sb.org/
> _______________________________________________
> calendarserver-users mailing list
> calendarserver-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/calendarserver-users

More information about the calendarserver-users mailing list