跳转到主要内容

launchd.plist模型

项目描述

安装

$ [sudo] pip install django-launchd

settings.py

INSTALLED_APPS = [
    "django_launchd",
]

模型

模型 __doc__
django_launchd.models.Plist launchd.plist模型。字段:path
django_launchd.models.Lock launchd.plist锁类。字段:plist(外键),key

示例

init

import django_launchd
from django_launchd.models import Plist

files = django_launchd.files("~/Library/LaunchAgents")
for f in files:
    Plist.objects.get_or_create(path=f)
Plist.objects.exclude(path__in=files).delete()

locks

for agent in filter(lambda a: a.exists, Plist.objects.all()):
    if <condition>:
        agent.lock("key")
    else:
        agent.unlock("key")

加载/卸载

for agent in filter(lambda a: a.exists, Plist.objects.all()):
    if agent.locks:
        agent.unload()
    else:
        agent.load()

django-readme-generator

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

django-launchd-2019.4.13.tar.gz (2.9 kB 查看哈希值)

上传时间:

支持者