0

I'm running a java application (on Ubuntu) with its own internal CLI but no API or access from outside. One solution I can think of is running this application in its own pseudoterminal and then writing commands to that terminal to submit commands. Is this the best way to do this? If so, is there a conventional way to wrap this sort of thing up? Is there a way that the pseudoterminal can be created, the application be launched within and then commands be sent from other terminals all simply and reliably?

Thanks,

Sam

Gausie
  • 111
  • 5
  • Maybe using FIFO-s will be a solution? `mkfifo /tmp/fifo-in; mkfifo /tmp/fifo-out; your-java-app < /tmp/fifo-in > /tmp/fifo-out`. Then write commands to /tmp/fifo-in and read output from /tmp/fifo-out. – 0xFF Dec 29 '12 at 20:25

1 Answers1

1

This is honestly probably not the greatest idea, but you could run it under screen via screen -d -m -s your-java-app. This would cause screen to start your app instead of a shell, and start it already detached. You could then attach to it as needed. You could even set up ACLs so that certain people could attach to it.

The biggest drawback I see is that Ctrl-A,C would end up running a second instance of your program. Maybe you could have a dedicated .screenrc to disable that binding.

wfaulk
  • 6,878
  • 7
  • 46
  • 75
  • Hey that worked really nicely, and I'm the only person to log in, but I've modified screenrc anyway. Cheers. – Gausie Dec 30 '12 at 20:45