需要Apple launch.h api的文档

问题描述 投票:3回答:1

我有一个通过终端加载的服务作为launchctl load /System/Library/LaunchAgent/com.example.my.plist

现在,我需要以编程方式检测服务是否正在运行并启动服务。 http://www.opensource.apple.com/source/launchd/launchd-328/launchd/src/launch.h以上是Apple提供的launch.h api的链接,有助于实现这一目标。

任何人都可以帮我提供文件吗?或者,帮助我如何使用api检查服务的状态并启动它。

谢谢。

macos terminal launch launch-agent
1个回答
0
投票

现在不推荐使用此API的大部分内容(macOS 10.14 SDK):

/*!
 * @header
 * These interfaces were only ever documented for the purpose of allowing a
 * launchd job to obtain file descriptors associated with the sockets it
 * advertised in its launchd.plist(5). That functionality is now available in a
 * much more straightforward fashion through the {@link launch_activate_socket}
 * API.
 *
 * There are currently no replacements for other uses of the {@link launch_msg}
 * API, including submitting, removing, starting, stopping and listing jobs.
 */

解决方案似乎使用launchctlman launchctl或在线的东西:https://ss64.com/osx/launchctl.html)。可能像launchctl list | grep <agent label>之类的东西。

© www.soinside.com 2019 - 2024. All rights reserved.