setting environment variable for launchctl

0

I've set up this todo.txt add-on and now I want to run todo.sh recur every morning. I've got Lingon (a Mac GUI) running the command, but I get the following error:

5/15/12 10:33:00.067 AM ryan-recurring-tasks: Can't exec "todo.sh": No such file or
directory at /Users/ryan/Dropbox/todo/.todo.actions.d/recur line 70.

I was advised to set the environment variable explicitly, but I'm not sure of the syntax. I've tried all these, but no dice:

launchctl setenv TODO_SH $TODO_SH

launchctl setenv TODO_SH $/Users/ryan/Dropbox/todo/todo.sh

launchctl setenv TODO_SH /Users/ryan/Dropbox/todo/todo.sh

Here are my Lingon settings for the command, in case there's an option there that might help. I don't know what the "Changes to this path" field represents...

Thanks for any help!

rda3000

Posted 2012-05-15T14:53:44.320

Reputation: 145

Answers

0

The recur script is expecting todo.sh to be in your path (that's what $TODO_SH eventually expands to). There are a number of ways to add your extended path (including the Dropbox todo dir) to launchd's path, but the better fix may be to edit the recur add-on to say:

my @args = ($ENV{TODO_FULL_SH}, "command", "add", $add);

instead.

If that works, let me know, I'll update the released script.

Paul Roub

Posted 2012-05-15T14:53:44.320

Reputation: 267

0

It looks like the script depends on /Users/ryan/Dropbox/todo/.todo.actions.d/recur. Does this file actually exist?

The "Changes to this path" options tells launchd to execute the script or command when the given folder is changed. It's unrelated to your problem.

Peet Corelli

Posted 2012-05-15T14:53:44.320

Reputation: 144

That file does exist, and here's the reference to todo.sh (around line 70) that is throwing the error: for my $add (@$adds) { my @args = ($ENV{TODO_SH}, "command", "add", $add); (system(@args) == 0) or die "system @args failed: $?"; } – rda3000 – 2012-05-15T17:14:14.800

So that's a php script? It seems like you'd need to call it like so, php -f /Users/ryan/Dropbox/todo/todo.sh Does it run if you invoke it manually? – Peet Corelli – 2012-05-16T00:35:16.857

it's perl - and it runs manually with just the command todo.sh recur – rda3000 – 2012-05-16T13:27:59.383