I'm trying to make a game server wrapper file for minecraft in C++ (Has to be Linux), doesn't have to be C++ so if someone has an alternative better language to do this in I will use it.
The main thing I want to do is write it start the server and then monitor with an IsAlive() function of sorts.
I also want to be able to commit console commands to the server from the C++ application.
I have managed to get it to launch the server using "execlp" but it pauses upon running that function. because I'm using the Fork the parent process continues to run which is ok, if someone knows of a way you can send commands the the child process which will actually run in the minecraft server this will almost be perfect.
This is what I have so far...
using namespace std;
int main(int argc, char** argv)
char* filetoexec = "/Servers/minecraft_server.jar";
cout << "Hello World: " << filetoexec << endl;
pid = fork();
cout << pid << endl;
cout << "Child Process" << endl;
execlp("java", "java", "-jar", filetoexec, "nogui", false);
cerr << "Failed" << endl;
cout << "Child Tick..." << getpid() << endl;
cout << "Parent Process" << endl;
cout << "Parent Tick..." << getpid() << endl;
//system("/list"); //An attempt at running a minecraft console command with no luck