Home Forums OS X Server and Client Discussion Questions and Answers Problem with launchd and running scripts

Viewing 1 post (of 1 total)
  • Author
  • #381841

    I have this issue with a script I run every four hours via launchd and some components of it not working. I just want to confirm if this is an issue and not something else.

    Anyway, here’s how it goes.

    I have my plist in /Library/LaunchDaemons set to run at launch and also every 4 hours

    The script itself runs fine and outputs results to the log. The issue though is in how extra scripts are executed.

    If I have something along the lines of:
    . /path/to/task.sh >> /log/output.log &
    The script task.sh doesn’t run

    If I have:
    . /path/to/task.sh >> /log/output.log
    it works fine.

    I’m happy to have the latter but I’m just curious why the former wouldn’t work at all. I’m thinking it doesn’t like running things in the background or the & is on the wrong spot
    (perhaps it should be . /path/to/task.sh & >> /log/output.log)

    It appears I could (should) have used the following
    (. /path/to/task.sh >> /log/output.log) &

    however I’m still interested to know what’s going on in the first example. It’s obviously wrong

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Comments are closed