Question for a Bash Guru - Startup Script Help

  • Thread starter Thread starter Dagon
  • Start date Start date
D

Dagon

Without going into too much detail, I have several Minecraft servers running on a physical dedicated CentOS server over a single IP.

To make administration easier, I have a startup script for each server instance. I have multiple server directories, each containing a server.jar with the same name.

The script launches each server.jar in a uniquely named screen session. So while the .jar has the same name, it comes from a different directory, and has its own uniquely named screen session.

Right now I am using this to determine whether or not the server.jar ($JARFILE) is running:

mc_status() {
ps aux |grep -F -v grep|grep -F -v SCREEN|grep -F --quiet $JARFILE
return $?
}

Unfortunately it detects ANY instance of server.jar running, no matter what screen session it is running in.

What I need is for this to detect whether or not a server.jar is running in a specifically named screen session, and I am unsure how to modify the script to do this.

The work around I am using is to name each server.jar something unique (server1.jar, server2.jar, etc), but this poses some other difficulties, and I would like to do this the "right" way. So any help at all with this would be much appreciated. Thank you in advance.

Continue reading...
 
Back
Top