launchagents+python

mac-agents的Python项目详细描述


安装
$ [sudo] pip install mac-agents

class^{}
^{}launchd.plist generator. Capital letter attrs/props as launchd.plist keys

函数

function^{}
^{}return a list of launchctl Job objects (^{}, ^{}, ^{})
^{}return a dictionary with plist file data
^{}update plist file data
^{}write data dictionary to a plist file

可执行模块
usage^{}
^{}generate launchd.plist from python file(s)
^{}set Finder tags. ^{} - status, ^{} - stderr, ^{} - unloaded

示例

~/Library/LaunchAgents/file.py

importmac_agentsclassAgent(mac_agents.Agent):StartInterval=5# capital letterdefrun(self):passif__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 {} +

链接

python-readme-generator

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java语义理解递归反向字符串返回语句   java toString()方法打印空值   java大型IN子句   如何使用JavaSpring在JavaScriptjQuery中设置post路径   java ByteArrayOutputStream已上载到服务器   java为什么轮询在SocketIO上获取数据“无法加载请求的项”?   java源代码应该以UTF8格式保存   Java数据库轮询器?   在Java中将double转换为float   java AccessDeniedException:C:\Windows\System32\drivers\etc\hosts