如何使用 launchd plist 產生簽章?

如何使用 launchd plist 產生簽章?

是否可以將以下 shell 腳本完全實作為 launchd plist 來生成帶有時間戳記的簽名在 StandardErrorPath / StandardErrorPath 檔案中?

#!/bin/sh
echo "Hi, your FOO.plist was here at $(date)"

這個不起作用:


<key>ProgramArguments</key>
   <array>
      <string>echo</string>
      <string>"Hi, your FOO.plist was here at $(date)"</string>
   </array>

答案1

launchd 不解釋$(date).外殼的作用是:

<key>ProgramArguments</key>
<array>
    <string>/bin/sh</string>
    <string>-c</string>
    <string>echo Hi, your FOO.plist was here at $(date)</string>
</array>

相關內容