Server restart script ?

Discussion in 'Bukkit Discussion' started by flyingtacoz, Oct 19, 2012.

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

    flyingtacoz

    Hello, does anyone have a restart script for linux that works ?
     
  2. Offline

    chaseoes

    I can give you one that doesn't work.
     
  3. Offline

    flyingtacoz

    Ok :D
     
  4. Offline

    TnT

    Look in my signature. Ascii Bukkit Menu (ABM). While its more than a restart script, it has that feature.
     
  5. Offline

    Lolmewn

    I use the RemoteToolkitWrapper for restarting the server - Also has crash detection. I use it because SpaceBukkit :)
     
  6. You can do this in the start file


    Code:
    @ECHO OFF
    //add this :begin
    SET BINDIR=%~dp0
    CD /D "%BINDER%"
    java.exe -Xmx7000M --Xms7000 -jar craftbukkit.jar
    //add this  goto begin
     
  7. Offline

    flyingtacoz

    wouldn't this just start the server up if I stopped it?
    Can anyone help me with this? It only works fine if I do it manually, though if I make a crontab for it and close the terminal. Once the crontab runs, it only stops the server and won't start it back up.
    Using linux(centos)/screen.
    Any help is appreciated, thanks.
    Code:
    #!/bin/sh
    screen -x minecraft -X stuff "say Server restarting in 30 seconds!"
    screen -x minecraft -X eval "stuff \015"
    sleep 5
    screen -x minecraft -X stuff "save-all"
    screen -x minecraft -X eval "stuff \015"
    sleep 10
    screen -x minecraft -X stuff "say Server restarting in 15 seconds!"
    screen -x minecraft -X eval "stuff \015"
    sleep 3
    screen -x minecraft -X stuff "butcher"
    screen -x minecraft -X eval "stuff \015"
    sleep 8
    screen -x minecraft -X stuff "say Server restarting in 5 seconds!"
    screen -x minecraft -X eval "stuff \015"
    sleep 5
    screen -x minecraft -X stuff "kickall Server is restarting!"
    screen -x minecraft -X eval "stuff \015"
    sleep 1
    screen -x minecraft -X stuff "stop"
    screen -x minecraft -X eval "stuff \015"
    sleep 30
    screen -wipe
    sleep 3
    cd /root/server
    ./start.sh
     
  8. Offline

    TheBeast808

    Why not just have crontab stop the server and then use an infinite loop in your start.sh so that it never needs to use ./start.sh?
     

  9. Sorry I thought you wanted it for when you stop the server... D:
     
  10. Offline

    flyingtacoz

    But what if one time I wanted to stop the server and not restart?
     
  11. Offline

    TheBeast808

    Stop the server and hit control+c. I have this setup and added a 5 second delay between the server completely stopping and restarting, so if i need to stop it I have 5 seconds to hit control+c.
     
  12. Offline

    flyingtacoz

    Can I see what your script looks like? And is this linux?
     
  13. Offline

    TheBeast808

    Yes, it's linux.
    I have mine setup in two files to make it easier for me. To start the server, I use ./run.sh. To restart, I use /stop. To completely stop the server, I use /stop, wait for it to finish, and use ctrl+c.
    run.sh:
    Code:
    #!/bin/sh
    screen -S "Minecraft" bash -c "sh /root/Creative/loop.sh"
    loop.sh:
    Code:
    #!/bin/sh
    while true
    do
            java -Xincgc -Xmx7G -jar craftbukkit.jar nogui
            echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
            echo "Rebooting in:"
            for i in 5 4 3 2 1
            do
                    echo "$i..."
                    sleep 1
            done
            echo "Rebooting now!"
    done
    Where " java -Xincgc -Xmx7G -jar craftbukkit.jar nogui" is whatever your server startup command is.
     
  14. Offline

    deathtaker26

    Take a look at McMyAdmin, the basic version does modify your properties so you can only have up to 8 people, but the professional version is cheap and well worth the pay, we use it and it allows us to stop start and reset our servers from any location.
     
  15. Offline

    flyingtacoz

    Thanks so much man! This works perfectly! :D
     
Thread Status:
Not open for further replies.

Share This Page