Minecraft Startscript

P

Penta

Boardmaler
Ich finde den Fehler nicht. Als Fehler kommt:
Code:
./startserver: 73: [[: not found

Und hier der Quellcode:
Code:
#!/bin/sh 

DIR="/home/marok"
DAEMON="java"
PARAMS="-Xmx3072M -Xms3072M -jar"
DATA="minecraft_server.jar"
PARAMS2="nogui"

NAME="Pfefferwerk"
DESC="Minecraft Server"

case "$1" in
start)
    if [[ `screen -ls |grep $NAME` ]]; then
        echo "found running prozess: $DESC: $NAME"
        echo "Dont start the Server twice"
        exit 1
        else
            if [ "$UID" = "0" ]; then
                echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
                for c in $(seq 1 10); do
                    echo -n "!"
                    sleep 1
                done
                echo !
            fi
            echo "starting the $DESC"
            if [ -e $DIR ];then
                if [ -x $DIR ]; then
                    cd $DIR
                    if [ ! -x $DATA ]; then
                        echo "$DATA is not executable, trying to set it"
                        chmod u+x $DATA
                    else
                        screen -d -m -S $NAME $DAEMON $PARAMS $DATA $PARAMS2
                    fi
                else
                    echo "No such directory: $DIR!"
                fi
            fi
    fi
;;

stop)
    if [[ `screen -ls |grep $NAME` ]]; then
        echo -n "Stopping $DESC: $NAME"
        screen -dr $NAME -X stuff "save-all"
        screen -dr $NAME -X stuff $'\n'
        sleep 5
        screen -r $NAME -X quit
        echo " ... done."
        sleep 3
    else
        echo "Coulnd't find a running $DESC"
    fi
;;

restart)
    $0 stop && $0 start || exit 1
;;
    
status)
    if [[ `screen -ls |grep $NAME` ]]; then
        echo "found running prozess: $DESC: $NAME"
        else
        echo "no running prozess: $DESC: $NAME"
    fi
;;

*)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 2
    esac

    exit 0
 
Hallo Penta,

ich tippe mal auf die fehlenden ;; vor esac, also hier:
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
HIER ;;

Gruß zst
 

Ähnliche Themen

Returncode ($?) bei find immer "0" ?

Switche abfragen über Script

NAS-Drive Mount in Bash-Script über crontab

Hilfe für ein shell script

script sshpass

Zurück
Oben