如何使用 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)。shell 会:

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

相关内容