ant_launcher.sh 1015 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # If we didn't specify a config name, give an error message.
  3. # We could default to default.conf, but we may not want this.
  4. if [[ -z $1 ]]; then
  5. echo "You must specify a config name, like this: ant_launcher.sh default"
  6. exit 1
  7. fi
  8. # Check if the specified config file exists, if not and if it's 'local', copy from default.conf
  9. if [[ $1 == "local" ]] && [ ! -f "$1.conf" ]; then
  10. echo "Local config not found. Creating local.conf from default.conf."
  11. cp default.conf local.conf
  12. # Check if the copy was successful
  13. if [ ! -f local.conf ]; then
  14. echo "Failed to create local.conf from default.conf. Exiting."
  15. exit 1
  16. fi
  17. fi
  18. # Run the game server
  19. echo "Running the game server with config named \"$1.conf\"."
  20. # Default to ZGC for production use
  21. command="ant runserverzgc -DconfFile=$1"
  22. # Use Java 8 if we specify it, like from single player run_server.sh
  23. if [[ -n $2 && $2 == "g1gc" ]]; then
  24. command="ant runserver -DconfFile=$1"
  25. fi
  26. screen -dmS $1 $command