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

CLI

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

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.

Source Distribution

mac-agents-2019.3.22.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mac_agents-2019.3.22-py2.py3-none-any.whl (82.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mac-agents-2019.3.22.tar.gz.

File metadata

  • Download URL: mac-agents-2019.3.22.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for mac-agents-2019.3.22.tar.gz
Algorithm Hash digest
SHA256 172e12689e1dc1191bb30f9c91cbca8a0f4e80c6dc45ce674cf82c26a6a6a9e3
MD5 91434064dcd521769dc924dc556f6112
BLAKE2b-256 8081beda0290dfff75b49704b4d7ba56538b3ca4108777eae214be2293e0cd86

See more details on using hashes here.

File details

Details for the file mac_agents-2019.3.22-py2.py3-none-any.whl.

File metadata

  • Download URL: mac_agents-2019.3.22-py2.py3-none-any.whl
  • Upload date:
  • Size: 82.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for mac_agents-2019.3.22-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 56f64cdd78236ebf05cfc0e0e51bb157f463ac033e7e27507c592774b1199b67
MD5 cd30507f8865ac567fc65b69752335af
BLAKE2b-256 bc3a4ef5cb11a34bdbdf91970ba446d4839fdf415b1fda99fb5e280c73b8c398

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page