小编Emm*_*ngi的帖子

如何以 root 身份运行 launchd 命令

我有以下 launchctl 命令作为 .plist 文件。它已加载并设置为每天运行一次,但是它需要以 root 身份运行,我不知道如何验证这一点。

此外,这个 cron 作业基本上 CD 到一个目录中并运行一个命令。我确信 launchd 有更好的方法来指定它应该运行命令的目录。

我怎么知道它是以 root 身份运行的,有没有更好的方法来编写它?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>dev.project.frontpage.feedparser</string>
    <key>ProgramArguments</key>
    <array>
        <string>cd</string>
        <string>/Users/eman/src/project/trunk/includes/;</string>
        <string>./feed-parser.php</string>
        <string>-c</string>
        <string>./feed-parser-config.xml</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>12</integer>
        <key>Minute</key>
        <integer>0</integer>
    </dict>
    <key>WatchPaths</key>
    <array/>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

mac root launchd cron macos

34
推荐指数
1
解决办法
6万
查看次数

标签 统计

cron ×1

launchd ×1

mac ×1

macos ×1

root ×1