Launchctl
- 系统启动时, 系统会以root用户的身份扫描/System/Library/LaunchDaemons和/Library/LaunchDaemons目录, 如果文件中有Disable的值为true, 则不会load进来, 否则就会load进来, 相当于执行了launchctl load -w path
- 用户登录时, 该用户会扫描/System/Library/LaunchAgent, /Library/LaunchAgent 和 ~/Library/LaunchAgent目录下的plist文件, 是否加载load取决于Disable键的值
- launchd的load与start是不一样的, 取决于RunAtLoad键的值, 如果true, 则表示load之后立马启动
- 一个简单的plist文件需要有Label(域名反写, 会在Launchctl list显示出来), Program, ProgramArguments, RunAtLoad(为true表示load时启动), Disable, StandardInPath, StandardOutPath, StandardErrorPath, StartInterval(几秒钟执行一次), WorkdingDirectory(临时目录是哪个)
- launchctl load ... ; launchctl unload ... ; launchctl start ... ; launchctl stop
- 如果配置文件中指明了Disable的话, 则需要-F强制load
- 使用LaunchControl工具, 配置起来方便
相关文章:
猜你喜欢
-
2021-11-06
-
2021-12-20
-
2022-12-23
-
2022-01-19
-
2022-12-23
-
2022-12-23
-
2022-12-23