def load_agent(): """returns zero if the plist was loaded, raises if it does not exist""" plist_path = installed_plist_path() assert os.path.exists(plist_path), "%s does not exist" % (plist_path) ret = sync_task([LAUNCHCTL_PATH, "load", "-w", "-S", "Aqua", plist_path]) if ret: log_message("unable to load agent %s" % (plist_path)) return ret
def unload_agent(): """returns zero in case of success or if the plist does not exist""" plist_path = installed_plist_path() ret = 0 if os.path.exists(plist_path): ret = sync_task([LAUNCHCTL_PATH, "unload", "-w", "-S", "Aqua", plist_path]) else: log_message("nothing to unload") if ret: log_message("unable to unload agent %s" % (plist_path)) return 0