daemondo / launchd just being silly on me

dreamcat four dreamcat4 at gmail.com
Tue Nov 10 02:54:03 PST 2009

Hello again,
The root of my problem:

On Sun, Nov 8, 2009 at 7:39 PM, dreamcat four <dreamcat4 at gmail.com> wrote:
> startupitem.executable  "${prefix}/lib/ruby/gems/1.8/bin/stompserver --working_dir /var"
> which creates the attached plist file. But for the life of me it just
> won't start.

It turns out there was one simple thing that we just didn't try:

- startupitem.executable  "${prefix}/lib/ruby/gems/1.8/bin/stompserver
--working_dir /var"
+ startupitem.executable  ${prefix}/lib/ruby/gems/1.8/bin/stompserver
--working_dir /var

Remove any quotes around the command which is sent to daemondo ! That
execvp() call is likely erroring out because the quotes aren't being
stripped off. However the c-lib function execvp(*args) will expect a C
array of the arguments (split strings). Daemondo is passing the whole
string in the first array element. execvp() attempts to execute on the
entire string (and fail), It should correctly execute when the first
array element is the command's filename. Then any subsequent array
elements are passed into the running command once it has been loaded.

Official letter-by-letter instructions aren't quite crystal clear
enough. The Macports documentation writes:

"Do not wrap values in quotes if passing arguments to the daemon;
“executable” StartupItem elements must be tagged individually so the
spaces between arguments serve as delimiters for “string” tags. ..."

Ref: http://ruderich.com/macports/chunked/ch05s07.html:

BUT says nothing against wrapping the entire command string in quotes
(from beginning to end including the params).

The TCL language looks so much like a regular shell script. In a bash
or bourne shell, the outside quotes would automatically be stripped
off. So its rather hard to point the finger at the Daemondo program
itself. Sometimetimes we need to use quotes because of spaces in the
command's path string.

For example:
startupitem.executable  "/path/with spaces in it/bin/cmd" --working_dir /var
=> $ daemondo "/path/with spaces in it/bin/cmd" --working_dir /var

In a few cases, we will want to run a command path with spaces and no arguments;

startupitem.executable  "/path/with spaces in it/bin/cmd"
daemondo "/path/with spaces in it/bin/cmd"

Wheras this is incorrect:
startupitem.executable  "/path/with spaces in it/bin/cmd --working_dir /var"
=> $ daemondo "/path/with spaces in it/bin/cmd --working_dir /var"

Hmm, maybe its worth to file a bug report just to improve the
documentation slightly.

dreamcat4 at gmail.com

More information about the macports-users mailing list