Skip to main content

LaunchAgents + python

Project description

Installation

$ [sudo] pip install mac-agents

Classes

class __doc__
mac_agents.Agent launchd.plist generator. Capital letter attrs/props as launchd.plist keys

Functions

function __doc__
mac_agents.jobs() return a list of launchctl Job objects (pid, status, label)
mac_agents.read(path) return a dictionary with plist file data
mac_agents.update(path, **kwargs) update plist file data
mac_agents.write(path, data) write data dictionary to a plist file

Executable modules

usage __doc__
python -m mac_agents.create path ... generate launchd.plist from python file(s)
python -m mac_agents.tag [path] set Finder tags. red - status, orange - stderr, gray - unloaded

Examples

~/Library/LaunchAgents/file.py

import mac_agents

class Agent(mac_agents.Agent):
    StartInterval = 5  # capital letter

    def run(self):
        pass

if __name__ == "__main__":
    Agent().run()
$ find ~/Library/LaunchAgents -name "*.py" | xargs python -m mac_agents.create "$@"
$ find ~/Library/LaunchAgents -name "*.plist" | xargs launchctl load # or launchctl unload
$ launchctl list | grep .py$ | awk '{print $3}' | xargs -I '{}' launchctl remove {}
$ find ~/Library/LaunchAgents -name "*.py.plist" -exec rm {} +

Links

python-readme-generator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mac-agents, version 2019.4.13
Filename, size & hash File type Python version Upload date
mac-agents-2019.4.13.tar.gz (4.8 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page