[CalendarServer-changes] [7324] CalendarServer/trunk/contrib/certupdate/calendarcertupdate.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 19 09:14:28 PDT 2011
Revision: 7324
http://trac.macosforge.org/projects/calendarserver/changeset/7324
Author: sagen at apple.com
Date: 2011-04-19 09:14:26 -0700 (Tue, 19 Apr 2011)
Log Message:
-----------
Only restart service if it's actually running and actually has SSL enabled.
Modified Paths:
--------------
CalendarServer/trunk/contrib/certupdate/calendarcertupdate.py
Modified: CalendarServer/trunk/contrib/certupdate/calendarcertupdate.py
===================================================================
--- CalendarServer/trunk/contrib/certupdate/calendarcertupdate.py 2011-04-18 21:39:17 UTC (rev 7323)
+++ CalendarServer/trunk/contrib/certupdate/calendarcertupdate.py 2011-04-19 16:14:26 UTC (rev 7324)
@@ -47,7 +47,7 @@
if isThisMyCert(CALDAVD_PLIST, sys.argv[2]):
try:
replaceCert(CALDAVD_PLIST, sys.argv[4])
- restartService()
+ restartService(CALDAVD_PLIST)
die("Replaced calendar cert with %s" % (sys.argv[4],), 0)
except Exception, e:
die("Error replacing calendar cert with %s: %s" % (sys.argv[4], e), 2)
@@ -102,16 +102,35 @@
writePlist(plist, plistPath)
-def restartService():
+def restartService(plistPath):
"""
Use serveradmin to restart the service.
"""
- log("Starting service via serveradmin")
- ret = subprocess.call([SERVER_ADMIN, "restart", "calendar"])
- log("serveradmin exited with %d" % (ret,))
+ plist = readPlist(plistPath)
+ if not plist.get("EnableSSL", False):
+ log("SSL is not enabled, so no need to restart")
+ return
+ if plist.get("EnableCardDAV", False):
+ log("Stopping addressbook service via serveradmin")
+ ret = subprocess.call([SERVER_ADMIN, "stop", "addressbook"])
+ log("serveradmin exited with %d" % (ret,))
+ log("Starting addressbook service via serveradmin")
+ ret = subprocess.call([SERVER_ADMIN, "start", "addressbook"])
+ log("serveradmin exited with %d" % (ret,))
+ elif plist.get("EnableCalDAV", False):
+ log("Stopping calendar service via serveradmin")
+ ret = subprocess.call([SERVER_ADMIN, "stop", "calendar"])
+ log("serveradmin exited with %d" % (ret,))
+ log("Starting calendar service via serveradmin")
+ ret = subprocess.call([SERVER_ADMIN, "start", "calendar"])
+ log("serveradmin exited with %d" % (ret,))
+ else:
+ log("Neither calendar nor addressbook services were running")
+
+
def log(msg):
try:
timestamp = datetime.datetime.now().strftime("%b %d %H:%M:%S")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110419/fe94d7be/attachment.html>
More information about the calendarserver-changes
mailing list