WARNING: The forum is now in read-only mode as we will soon be transitioning to different forum software. Feel free to join our Discord server in the meantime.
User avatar
dekart811
Posts:8
Joined:Wed Dec 26, 2012 8:47 pm
Location:Germany
Contact: Website
[REL]Linux Server Startscript

Wed Jan 02, 2013 2:13 pm

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
Image

User avatar
CactusPie
Posts:451
Joined:Mon Dec 17, 2012 4:48 pm
Location:Poland

Re: [REL]Linux Server Startscript

Wed Jan 02, 2013 2:21 pm

Thanks! I'm sure it will come in handy.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 37 guests