Minecraft on Debian:

Allgemein

Screen wird benutzt damit der server läuft bei Abwesenheit

```

apt-get install default-jre screen ```

iptables.firewall.rules:

``` -A INPUT -p tcp –dport 25565 -j ACCEPT (MC) -A INPUT -p tcp –dport 25565 -j ACCEPT (Remoute)

```

Scribt Version 1 (nicht benutzt)

nano /etc/init.d/mc-server

``` ######################### # Config bitte anpassen # #########################

user=*user*
base_dir=/home/minecraft
screen=minecraft-1     
jar_file=/minecraft_server.1.11.2.jar

##################
# Script-Bereich #
##################

script_path=${base_dir}/
init_log=${base_dir}/logs/minecraft.init.log

case "$1" in
    start)
            sudo -u ${user} screen -A -dmS ${screen} java -Xmx1024M -Xms1024M -jar 
${base_dir}${jar_file} >> $
    ;;
    restart)
            sudo -u ${user} screen -X -S ${screen} quit >> ${init_log}
            sudo -u ${user} screen -A -dmS ${screen} java -Xmx1024M -Xms1024M -jar 
${base_dir}${jar_file} >> $
    ;;
    stop)
            sudo -u ${user} screen -X -S ${screen} quit >> ${init_log}
    ;;
    *)
            echo "Usage: /etc/init.d/mc-server {start|stop|restart}"
            exit 1
    ;;
esac

```

Rechte anpassen zum ausfüren:

```

chmod +x /etc/init.d/mc-server

```

Sript Variation 2

vorbereitung:

im verzeichnis /root/scripts

```

git clone https://github.com/Ahtenus/minecraft-init.git ln -s ~/scripts/minecraft-init/minecraft /etc/init.d/minecraft

```

rechte anpassen und updat-rc:

```

chmod 755 ~/scripts/minecraft-init/minecraft update-rc.d minecraft defaults

```

Cronjobs:

```

crontab -e

Add these lines:
#m         h         dom        mon        dow        command
02         05         *        *        *        /etc/init.d/minecraft backup
55         04         *        *        *        /etc/init.d/minecraft log-roll
*/30         *         *        *        *        /etc/init.d/minecraft to-disk

```

Config anpassen:

```

cp config.example config nano config und anpassen

```

Screen:

``` .bash_profile :

if [ "$TERM" != "screen" ] && [ "$SSH_CONNECTION" != "" ]; then
    /usr/bin/screen -S S-minecraft -d -R && exit
fi

```