Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.