我正在尝试创建一个新的启动文件,该文件将执行shell脚本以在ftp文件夹上执行备份。 .plist文件的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.team.backup</string>
<key>ProgramArguments</key>
<array>
<string>/Users/jackm/Documents/Uni/backup.sh</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>15</integer>
<key>Minute</key>
<integer>30</integer>
</dict>
</array>
<key>StandardErrorPath</key>
<string>/Users/jackm/Documents/Uni/backup_err.log</string>
</dict>
</plist>
backup.sh文件如下:
#!/bin/bash
scp -r username@thehost.co.uk:/the/ftp/folder/ "/Users/jackm/morefolders/Backups/D2 Backup/$(date '+%d-%b-%H:%M')"
当我通过终端执行时,backup.sh文件运行绝对正常,要求我输入密码然后下载文件夹。 在使用launchd时,我甚至没有提示输入密码,我只是在错误日志文件中得到以下内容:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
launchctl list使plist具有状态1。 〜/ etc / ssh_config PasswordConfirmation为1 .plist文件位于启动文件夹
中干杯