Page 1 of 1

[REL]Linux Server Startscript

Posted: Wed Jan 02, 2013 2:13 pm
by dekart811
I've created a startscript for my server, running on Debian 6 (Squeeze) and I want to share it with the community.
Maybe it's helpfull for other people, too.
I also added a function to delete all log files. :D

Code: Select all

# EmulatorNexus Project Rome - ServerStartScript - by dekart811

# Settings
SERVERNAME="Servername"
SERVERPORT=19567
SCREENNAME=bfbc2-$SERVERPORT
SERVERDIR=/path/to/your/server/
INSTANCEPATH=instance/
MAPPACK2=0
DISPLAY=:1
BINARY=Frost.Game.Main_Win32_Final.exe
ARGUMENTS="-serverInstancePath $INSTANCEPATH -mapPack2Enabled $MAPPACK2 -port $SERVERPORT -timeStampLogNames -region OC -heartBeatInterval 20000"

# don't edit any code below this line

case "$1" in
   start)
      echo "Starting Server:" $SERVERNAME "("$SERVERPORT")"
      cd $SERVERDIR
      export DISPLAY=$DISPLAY
      screen -AmdS $SCREENNAME wine $BINARY $ARGUMENTS
      echo "Server started:" $SERVERNAME "("$SERVERPORT")"
   ;;
   stop)
      echo "Stopping Server:" $SERVERNAME "("$SERVERPORT")"
      screen -S $SCREENNAME -X quit
      echo "Server stopped:" $SERVERNAME "("$SERVERPORT")"
   ;;
   restart)
      echo "Restarting Server:" $SERVERNAME "("$SERVERPORT")"
      screen -S $SCREENNAME -X quit
      cd $SERVERDIR
      export DISPLAY=$DISPLAY
      screen -AmdS $SCREENNAME wine $BINARY $ARGUMENTS
      echo "Server restarted:" $SERVERNAME "("$SERVERPORT")"
   ;;
   clean)
      cd $SERVERDIR
      rm -rf */*.log
      echo "CleanUp done:" $SERVERNAME "("$SERVERPORT")"
   ;;
   *)
      echo "Usage: $0 (start|stop|restart|clean)"
      exit 1
   ;;
esac
exit 0

Re: [REL]Linux Server Startscript

Posted: Wed Jan 02, 2013 2:21 pm
by CactusPie
Thanks! I'm sure it will come in handy.