Greetings all -
I've read lots of posts already so I think I understand different ways of starting up a script or program when the jail starts. In my case, I am wanting to start a simple java program (in a jar file) that is basically like a chat server.
I have figured out how to start the program in various ways:
These are my baby steps to figure this out because I'm quite new at this particular activity:
Step 1
Make sure the program can run inside the jail outside of any kind of start up mechanism. After installing the jdk version I needed, and after putting my jar file into the jail via FTP, I am able to run the following successfully:
I can also write a script to start the program successfully (startmessageserver.sh):
Step 2
Try to get it to run when the jail starts up. I was able to get this working using both (either) an rc.local file or an rc.d script. In either case, I can call the jar execution directly or call the startmessageserver.sh script. Both of these work, as I am able to connect to my server from a client machine.
My problem, however, is that when I start the jail it just sits there. If I start the jail through the GUI, I get the popup that says "Starting job" and it sits there for ever. It has started my program successfully, but the screen sits there forever.
I thought maybe my problem has to do with maybe it's waiting for output? So I changed my commands to something like this:
But that doesn't seem to work either. I feel like I'm missing something fundamental but I'm not sure what it is.
I've read lots of posts already so I think I understand different ways of starting up a script or program when the jail starts. In my case, I am wanting to start a simple java program (in a jar file) that is basically like a chat server.
I have figured out how to start the program in various ways:
These are my baby steps to figure this out because I'm quite new at this particular activity:
Step 1
Make sure the program can run inside the jail outside of any kind of start up mechanism. After installing the jdk version I needed, and after putting my jar file into the jail via FTP, I am able to run the following successfully:
Code:
java -jar MessageServer.jar
I can also write a script to start the program successfully (startmessageserver.sh):
Code:
#!/bin/sh /usr/local/bin/java -jar /root/MessageServer.jar
Step 2
Try to get it to run when the jail starts up. I was able to get this working using both (either) an rc.local file or an rc.d script. In either case, I can call the jar execution directly or call the startmessageserver.sh script. Both of these work, as I am able to connect to my server from a client machine.
My problem, however, is that when I start the jail it just sits there. If I start the jail through the GUI, I get the popup that says "Starting job" and it sits there for ever. It has started my program successfully, but the screen sits there forever.
I thought maybe my problem has to do with maybe it's waiting for output? So I changed my commands to something like this:
Code:
#!/bin/sh /root/startmessageserver.sh >/dev/null 2>&1
But that doesn't seem to work either. I feel like I'm missing something fundamental but I'm not sure what it is.