[Ressource] Restart and map exchange script

Discussion in 'Systems Administration' started by Vinc0682, Jun 29, 2016.

  1. Hey there,

    here is a bash script I made for bedwars on my server, you can use this for any bungee-cord minigame.

    Code
    Code (Text):
    #! /bin/bash

    # DEBUG STEP ONE: CHECK THE SETTINGS!
    TEPMLATE_DICTIONARY=/path/to/your/maps/with/configs
    SERVER_DICTIONARY=/path/to/your/server
    RESTART_DELAY=5

    # IF YOU ARE EXPIRENCING ANY ERRORS, CHECK THE SETTINGS FIRST!
    while true
    do
        for template in $TEPMLATE_DICTIONARY/*; do
                if [[ -d $template ]]; then
                echo ""
                    echo "[RESTART] You have ${RESTART_DELAY} seconds to press CTRL + C from now!"
                    sleep $RESTART_DELAY
                    echo "[RESTART] Restart was not abborted, restarting..."
                    echo "[RESTART] Now copying template from $template."
                cp -ar $template/* ./
                echo "[RESTART] Finished copying."

                echo "[RESTART] Starting!"
                echo ""
                ./startServer.sh
                echo ""
                find . -type f -exec cmp -s '{}' "$template/{}" \; -exec rm -f "$SERVER_DICTIONARY/{}" \;
                echo "[RESTART] Removed old template data."
                fi
        done
    done
     

    Setup


    1. Copy the script into your folder and configure the variables at the start of the file.
    2. Create a file named startServer.sh which contains your java-command to start the server.
    3. run "chmod +x ./startServer.sh" and "chmod +x ./yourFile.sh"
    4. Set up your templates (map + specified config files)
    5. Enjoy the script.

    How does it work?

    It firstly copies a template into the server dictionary, starts the server, waits until it's stopped, removes the old template data, gives you some time to break out of the circuit and begins again.
     
  2. Thank you,
    very nice!

    Please help me to Reach the 20 Likes