我正在尝试从机器人运行一些服务器,但我不能让它运行我的屏幕并托管服务器。我已经尝试过调试并获得某种代码来调试,但我什么也没想到。也许它是我的语法中的东西?
这些是你可以运行的值:name = factorio,path = / opt / factorio / bin / x64 / factorio,args = --start-server map.zip
一起做:
screen -dmS factorio -m bash -c "/opt/factorio/bin/x64/factorio --start-server map.zip"
public boolean run() {
try {
System.out.println("screen -dmS "+serverName+" -m bash -c \""+path+" "+args+"\"");
Process proc = rt.exec("screen -dmS "+serverName+" -m bash -c \""+path+" "+args+"\"");
BufferedReader read = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String str = null;
while ( (str = read.readLine()) != null)
System.out.println(str);
try {
proc.waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Exit value: "+proc.exitValue());
this.setStatus(ONLINE);
return true;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}