How can I add arguments to OSX launchd plist to pipe output to a log file?

前端 未结 3 1917
滥情空心
滥情空心 2021-02-10 05:53

I have tried many different variation on this but just can\'t get it to work.

I have a plist file:




        
3条回答
  •  庸人自扰
    2021-02-10 06:02

    >> is a shell operator, not a program argument, and launchd doesn't pass its commands through a shell (unless you force it, as in @Lauri's answer). But launchd does have its own option for redirecting stdout:

    StandardOutPath
    /Users/ilium007/support/scripts/handbrake/logs/handbrake_encode.log
    

    Note that it automatically appends (equivalent to >>, not >). You can also redirect stderr with the StandardErrorPath key. One thing you cannot do is use ~ (as in ~/support/scripts/handbrake/logs/handbrake_encode.log) -- that, again, is a shell feature that launchd doesn't emulate.

提交回复
热议问题