Launchctl - mac下的运行管理器


 

前面的文章提到了 launchctl,我就根据这个线索整理一下。

 

launchctl 是 launchd的控制台(也就是人机交互的终端)用于装载进程、卸载进程并控制launchd。

launchctl 也就是launchd的封面,这么说是为了避免让人感到意外,说launchctl怎么跑到launchd上了。

 

launchd时mac os最核心的系统组件之一。

Mac OS 系统启动最先做的事就是运行launchd,由launchd完成其他的后续启动工作。

launchd代码已经开源,

 

1、launchd可以作为定时器使用,像linux下的 cron

2、launchd可以作为目录监听器,监听目录文件的变化

3、launchd可以根据配置启动或者停止服务进程,这个用的最多。

 

launchd以plist文件作为配置输入,文件格式见参考[2]和[3]

 

参考


[1]https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/launchctl.1.html

[2]https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html

[3]https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/plist.5.html

[4]http://paul.annesley.cc/2012/09/mac-os-x-launchd-is-cool/

[5]https://segmentfault.com/a/1190000000509514?utm_source=tuicool&utm_medium=referral#articleHeader4

相关内容

    暂无相关文章