From 7d2e7fe406025dcb2406ce5836cc18725a576af3 Mon Sep 17 00:00:00 2001 From: Joey Hagedorn Date: Tue, 2 Jan 2007 22:41:02 +0000 Subject: working on initial launchd service support implementation git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2617 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/launchd.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/Client/Tools/launchd.py b/src/lib/Client/Tools/launchd.py index eb925dd5c..2957c8869 100644 --- a/src/lib/Client/Tools/launchd.py +++ b/src/lib/Client/Tools/launchd.py @@ -51,5 +51,18 @@ class LaunchD(Bcfg2.Client.Tools.Tool): def BundleUpdated(self, bundle): '''Reload LaunchD plist''' - pass + for entry in [entry for entry in bundle if self.handlesEntry(entry)]: + if not self.canInstall(entry): + self.logger.error("Insufficient information to restart service %s" % (entry.get('name'))) + else: + if entry.get('status') == 'on': + #may need to start/stop as well! + self.logger.info("Reloading LaunchD service %s" % (entry.get("name"))) + #stop? + self.cmd.run("/bin/launchctl unload %s" % (entry.get("plist")))#what if it disappeared? how do we stop services that are currently running but the plist disappeared?! + self.cmd.run("/bin/launchctl load %s" % (entry.get("plist"))) + #start? + else: + #may need to stop as well! + self.cmd.run("/bin/launchctl unload %s" % (entry.get("plist"))) -- cgit v1.2.3-1-g7c22