我有一个进程。
Runtime rt = Runtime.getRuntime() ;
Process p = rt.exec(filebase+port+"/hlds.exe +ip "+ip+" +maxplayers "+players+ " -game cstrike -console +port "+port+" -nojoy -noipx -heapsize 250000 +map de_dust2 +servercfgfile server.cfg +lservercfgfile +mapcyclefile mapcycle.txt +motdfile motd.txt +logsdir logs -zone 2048",null, new File(filebase+port)) ;
我希望能够监控这个进程,无论它是否正在运行或已经崩溃,在崩溃的情况下需要重新启动它。该进程可以有多个实例,具体数量取决于端口。
我能在Linux和Windows上跟踪这个进程吗?我读了一些相关文章,但是这个情况有点不同,因为它涉及到多个出现的实例,并且必须仅检查特定的进程。