Skip to content

FIFO and Pipes with Bluepill #41

@jamestaylr

Description

@jamestaylr

I am trying to use a FIFO (named pipe) with Bluepill.

In the console, if I directly run:

tail -f /srv/input.fifo | /usr/lib/jvm/java-7-openjdk-amd64/bin/java -jar server.jar

The server starts fine and begins running. I can also redirect to the pipe, as expected:

echo 'Hello World' > /srv/input.fifo

And the server responds and behaves as intended.

I am trying to port this same functionality over to Bluepill, but I'm having some trouble. Here's the Bluepill application script:

Bluepill.application('server', log_file: '/srv/bluepill.log') do |app|
  app.process('server') do |process|
    process.pid_file = '/var/run/server.pid'
    process.working_dir = '/srv'
    process.start_command = "tail -f /srv/input.fifo | /usr/lib/jvm/java-7-openjdk-amd64/bin/java -jar server.jar"
    process.daemonize = true
  end
end

Bluepill, from the log, reflects the start_command correctly:

WARN -- : [server:server] Executing start command: tail -f /srv/input.fifo | /usr/lib/jvm/java-7-openjdk-amd64/bin/java -jar server.jar

But the server never starts running. ps aux | grep 'server' shows that it isn't running and pidof java returns nothing. Additionally, I can tell from the server's log that it never attempts to run.

If I remove tail -f /srv/input.fifo | from the start_command, the Bluepill process works as expected, although it obviously isn't using the pipe.

Out of desperation, I also tried setting an stdin attribute in the process file because this definition appeared in the repo's code (but not in the documentation), like so:

process.stdin = "/srv/input.fifo"

How can I get Bluepill to call the server using the FIFO?

I originally posted this on StackOverflow, but it hasn't gotten much attention. Given that the README shows a complex implementation with redirection and conditional operation (cd /tmp/some_dir && SOME_VAR=1 /usr/bin/some_start_command > /tmp/server.log 2>&1), this looks to me more like a bug with Bluepill. I see no mention of pipes in the documentation, so it could be that this functionality is not supported.

Let me know! Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions