launchctl

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工具, 配置起来方便
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值