我写了以下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.jacksonbockus.dnd.sync</string>
<key>UserName</key>
<string>jacksonbockus</string>
<key>ProgramArguments</key>
<array>
<string>/Users/jacksonbockus/Documents/Dev/aws/s3-sync.sh</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/jacksonbockus/Documents/Dev/aws/s3-out.txt</string>
<key>StandardErrorPath</key>
<string>/Users/jacksonbockus/Documents/Dev/aws/s3-err.txt</string>
</dict>
</plist>
为了执行这个脚本:
#!/bin/zsh
/usr/local/bin/fswatch /Users/jacksonbockus/fvtt | (while read; do
/usr/sbin/dot_clean Users/jacksonbockus/fvtt;
/usr/local/bin/aws s3 sync /Users/jacksonbockus/fvtt s3://jbockus-fvtt/ --delete --acl public-read;
done;)
我用这个命令加载它:
launchctl load -w s3-sync.plist
我现在收到此错误:
Sep 17 10:58:50 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync[4919]): Service could not initialize: 20G95: xpcproxy + 23787 [839][12D7C9E4-2F89-3A76-A1C0-D310F417BC41]: 0x1
Sep 17 10:58:50 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync[4919]): Service exited with abnormal code: 78
Sep 17 10:58:50 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
我正在运行 macOS 11.5.2。我不知道 0x1 指的是什么错误,所以我不知道如何解决它。如果有人可以帮助我找出问题所在,我将不胜感激。
编辑:我已删除 StandardOutPath 和 Standard ErrorPath 并收到新错误
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync): This service is defined to be constantly running and is inherently inefficient.
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.apple.xpc.launchd.user.domain.501.100006.Aqua): com.jacksonbockus.dnd.sync (lint): UserName is not supported for non-System services.
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync[7069]): Service exited with abnormal code: 127
Sep 17 12:14:02 Jacksons-MacBook-Pro com.apple.xpc.launchd[1] (com.jacksonbockus.dnd.sync): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.