Running riak from launchd?

Izzy Alanis izzyalanis at
Sat May 26 10:38:13 EDT 2012

Has anyone gotten riak to run under launchd?

Or, is there a way to run riak in console mode without the interactive
erlang shell?

Launchd doesn't want its subprocesses to daemonize themselves. If I
set up a launch file to run riak in the foreground with "riak
console", its the same as running "riak console < /dev/null"  from the
command line, and (I'm guessing here:) the interactive shell sees the
end of stream and ends the console session.

I expect you'd have the same problem using supervisor as your process
controller. Supervisor has a pixproxy program to help in these sort of
situations, but riak is not writing out a pid file either(?!).

Things I've tried:

Piping input from /dev/zero is understandably disastrous:
> riak console < /dev/zero

Piping input from a fifo just hangs:
> mkfifo < /tmp/myfifo
> riak console < /tmp/myfifo

This seems to mostly work (or might really work well with some extra
bash scripting):
> mkfifo < /tmp/myfifo
> echo > /tmp/myfifo &
> riak console < /tmp/myfifo
I have that last one in a wrapper script. I could add the bells and
whistles to make the fifo a random filename and make sure it gets
cleaned up after the script end, etc, etc, etc.

Here's my launch config (below), FYI. I'm running it out of
/Library/LaunchDaemons, and errang *really* wants a HOME environment
variable which is a gotcha for anybody else out there!:

Anybody else get something like this working?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
<plist version="1.0">

More information about the riak-users mailing list