startscript

Discussion in 'Bukkit Help' started by Uniclaw, Dec 30, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Uniclaw

    Hi!

    What that is doing? And how can i modify it?
    Code:
    grep max-players= server.properties &>/dev/null
    if [[ $? -eq 0 ]]; then
      sed -i server.properties -e "s/^\(max-players=\).*$/\1${PLAYER}/"
    else 
      echo "max-players=${PLAYER}" >> server.properties
    fi
     
  2. Offline

    falkensmaze

    Uniclaw

    This code modifies your server.properties file, setting the max-players option to the value of $PLAYER (whatever that is) as defined in your environment, or earlier in the script.

    What do you want it to do?
     
  3. Offline

    Uniclaw

    I wan't to edit the maximum amount of slots :3
     
  4. Offline

    falkensmaze

    Well, max-players sets the number of slots. Where did you get this? Is there more of it? Post the whole thing.
     
  5. Offline

    Uniclaw

    Code:
    #!/bin/bash
     
     
    while test $# -gt 0; do
     case "$1" in
     "-IP")
        IP="$2"
        shift;;
     "-PORT")
        PORT="$2"
        shift ;;
     "-PLAYER")
        PLAYER="$2"
        shift ;;
     "-RAM")
        RAM="$2"
        shift ;;
     "-ADDON")
        ADDON="$2"
        shift ;;
     esac
     shift
    done
     
    if [ ! -f minecraft_server.pid ]; then
      echo ""
    else 
      pid=`cat minecraft_server.pid`
      kill -KILL $pid
      rm -rf minecraft_server.pid
    fi
     
    grep server-ip= server.properties &>/dev/null
    if [[ $? -eq 0 ]]; then 
      sed -i server.properties -e "s/^\(server-ip=\).*$/\1${IP}/"
    else  
      echo "server-ip=${IP}" >> server.properties
    fi
     
    grep server-port= server.properties &>/dev/null
    if [[ $? -eq 0 ]]; then  
      sed -i server.properties -e "s/^\(server-port=\).*$/\1${PORT}/"
    else  
      echo "server-port=${PORT}" >> server.properties
    fi
     
    grep max-players= server.properties &>/dev/null
    if [[ $? -eq 0 ]]; then 
      sed -i server.properties -e "s/^\(max-players=\).*$/\140/"
    else 
      echo "max-players=${PLAYER}" >> server.properties
    fi
     
    if [ $ADDON == "Bukkit" ]; then
    java -Xms"$RAM"M -Xmx"$RAM"M -jar craftbukkit.jar nogui $IP $PORT
    else
    java -Xmx"$RAM"M -Xms"$RAM"M -jar minecraft_server.jar nogui $IP $PORT
    fi
    
    It's from my Server - A friend telld me that i must use that and not my old start.sh..
     
  6. Offline

    falkensmaze

    Uniclaw

    It looks like this script is intended to be run by a system startup script, which is what you should really be adjusting. You've hardcoded it now to 40 slots (and maybe broken it in other subtle ways). Ask your friend for some guidance if possible.
     
  7. Offline

    Uniclaw

Thread Status:
Not open for further replies.

Share This Page