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

Toby Rush toby.rush at unco.edu
Fri Jan 11 11:41:36 PST 2008


I had trouble installing Calendar Server as a system service using  
launchd, and I thought I'd share my solution with the list in case  
there are others out there like me that know just enough to be  
dangerous.

This assumes that you have Calendar Server installed and can launch it  
manually using "./run -d".

As suggested on the list in November, I downloaded Lingon (http://lingon.sourceforge.net 
) to simplify the process of creating a launchd service. In Lingon,  
create a new service and set it as a User Daemon. Enter the following  
information:

Name: com.apple.calendarserver
What: /Library/CalendarServer/run -d (if you have CalendarServer  
installed somewhere else, adjust this appropriately)
When: Select "Run it when it is loaded by the system (at startup or  
login)".

If you save this and restart your computer... it won't work! The  
console reports an "unbound variable" error and the service doesn't  
start.

The cause of this, as near as I can tell, is due to what looks like  
debugging code in the "run" script. Open CalendarServer/run in a text  
editor (after making a backup!) and search for the following, toward  
the end of the script:

#
# Twisted
#

case "${USER}" in
   wsanchez)
     proto="svn+ssh";
     ;;
   *)
     proto="svn";
     ;;
esac;
svn_uri="${proto}://svn.twistedmatrix.com/svn/Twisted/branches/dav- 
acl-1608-4";
svn_get "Twisted" "${twisted}" "${svn_uri}" 19773;

The problem (I think) is that USER is not defined when the script is  
run at startup, but the case statement is in there for debugging  
purposes; we just need proto set to "svn". So you can delete (or  
comment out) all but the three lines of the above code:

proto="svn";
svn_uri="${proto}://svn.twistedmatrix.com/svn/Twisted/branches/dav- 
acl-1608-4";
svn_get "Twisted" "${twisted}" "${svn_uri}" 19773;

There is one more block of code that checks the USER variable and thus  
needs to be changed:

case "${USER}" in
   cyrusdaboo)
     base="svn+ssh://cdaboo@svn.osafoundation.org/svn";
     ;;
   *)
     base="http://svn.osafoundation.org";
     ;;
esac;
svn_uri="${base}/vobject/branches/users/cdaboo/vavailability-173";
svn_get "vObject" "${vobject}" "${svn_uri}" 178;
put_setuptools "${vobject}";

In this case, we need only to initialize the "base" variable, so it  
can be replaced with this:

base="http://svn.osafoundation.org";
svn_uri="${base}/vobject/branches/users/cdaboo/vavailability-173";
svn_get "vObject" "${vobject}" "${svn_uri}" 178;
put_setuptools "${vobject}";

Now, maybe this messes something up that I don't understand, but  
making these changes to the script and restarting seems to do the  
trick. I hope this helps someone else out as well.

**************************************************
Toby W. Rush - toby.rush at unco.edu
Instructor of Music Theory
PVA Webmaster & Technical Operations Manager
University of Northern Colorado
"Omnia voluntaria est."
**************************************************





More information about the calendarserver-users mailing list