Using jq to parse JSON in launchd

后端 未结 2 670
长情又很酷
长情又很酷 2021-01-24 06:04

I have a shell script that evaluates a folder full of JSON files which runs fine when invoked directly but fails when run from launchd. Specifically, launchd fails on this line:

2条回答
  •  走了就别回头了
    2021-01-24 06:40

    As the very first process that runs in Mac OS X, launchd has no environment (including a PATH parameter) except for what you specify in /etc/launchd.conf. You could create that file and add

    setenv PATH "/usr/local/bin"
    

    If you want the full environment associated with your regular shell sessions, you should execute your script explicitly as a login shell:

    bash -l myscript.bash
    

提交回复
热议问题