需要帮助让启动守护程序在 macOS 上运行

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

我有一个启动守护进程,但我无法开始工作。它应该每天凌晨 3 点运行一个脚本。该脚本有效,我可以手动运行它,无需 sudo。请参阅下面的启动守护进程 (com.rsync.plist) 以及我运行来启动它的命令的输出。如果有人知道为什么它无法运行,我将非常感激。

'''

<?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>com.rsync</string>
                <key>Program</key>
                <string>/Users/xserve10/Documents/rsync.sh</string>
                <key>StartCalendarInterval</key>
                <dict>
                        <key>Hour</key>
                        <integer>3</integer>
                        <key>Minute</key>
                        <integer>0</integer>
                </dict>
        </dict>
</plist>


Xserve-10s-Mac-mini:Documents xserve10$ ls /Library/LaunchDaemons/com.rsync.plist
/Library/LaunchDaemons/com.rsync.plist
Xserve-10s-Mac-mini:Documents xserve10$ sudo launchctl load -w /Library/LaunchDaemons/com.rsync.plist
Password:
/Library/LaunchDaemons/com.rsync.plist: service already loaded
Load failed: 37: Operation already in progress

'''

macos plist launchd
1个回答
0
投票
  • sudo launchctl卸载/Library/LaunchDaemons/com.rsync.plist
  • sudo launchctl load -w /Library/LaunchDaemons/com.rsync.plist
© www.soinside.com 2019 - 2024. All rights reserved.