[Tool] CraftBukkit Server Manager [Mac & Linux]

Discussion in 'Bukkit Tools' started by PierreLouis, Jun 17, 2012.

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

    PierreLouis

    If they happen again, please paste them here so that I can see what they are.
    I've just pushed the update.
     
  2. Offline

    gustebeast

    Great the errors are all gone and spigot works well, but ctrl + a + d does not work, it just makes a new > sign in the line, when I press enter it says unknown command
     
  3. Offline

    PierreLouis

    You have to hold Ctrl, press A, and then press D. You can train on an empty Terminal window.
     
  4. Offline

    A520

    Nice, but you should use "screen -rx" without "x" you can kill screen when you use Ctrl + D without A.
    I too have some scripts for minecraft but not all together.

    You should duplicate function Start and Stop but use all small chars and add script to put your symbolik links in /etc/rc.0X, in example links -l Run.command /etc/rc.01/K/S01Run.command. Then if serwer was started your script will executed with parameter start or stop when serwer is turns off.

    K/S - Kill or Start read something about run level in linux

    Oh no, you should not use 'cp -R' for backup, and don't stop save-all in minecraft, your backup might be corrupted, you should use befor copy "screen -S NAME -X stuff 'save-all \n save-off'" backup script and "screen -S NAME -X stuff 'save-on \n'" (\n - I dont want write full command :) ), and you should use to backup rsync or something else to create copy in another directory and then you can use tar or zip or something else :)

    mcvps.waw.pl/sync_bak.sh
    mcvps.waw.pl/MC.sh

    I wrote these scripts some time ago.
    And by the way sorry for my english,
     

    Attached Files:

    PierreLouis likes this.
  5. Offline

    gustebeast

    Same issue, If I open a new terminal tab fresh with no server log on it and then do ctrl a d, it says "logout" then [process completed]. When I do it on the tab with the server log on it, it just makes a >

    nevermind it somehow fixed itself, as most problems do :p

    But restarting is still not working perfectly. Sometimes the server doesnt shut down, other times it doesnt start back up.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  6. Offline

    PierreLouis

    I'm currently rewriting the script because it was pretty messy, once I'm done, we'll finally have 1.0! :)
    It'll have an awesome new layout with a status bar (WIP-Pic), but the classic server only view will be an option, notifications, with a cool animation! :D
    And it'll be MUCH faster!

    I'll keep all of that in mind, thank you! :)

    All of your problems will be gone with 1.0, please be patient. :)
     
  7. Offline

    gustebeast

    Sounds good!
     
  8. Offline

    A520

    No problem, but you should fix backup script adding save-all, save-off and save-on, as finished.
     
  9. Offline

    hawkfalcon

    What's wrong?
     
  10. Offline

    PierreLouis

    Yep, that's in the new backup code! :)
     
  11. Offline

    gustebeast

    I am ssh'ing into a linux server to run this script. I start the server up and I can switch between the script prompt and the server prompt normally by using ctrl + a + d and the view command. When I exit out of terminal and try to reconnect the only screen session I can hook into is "Minecraft-Server" so I do screen -r minecraft-server. This is nice because I can type commands to the log, but unfortunatly I cannot get back to the script menu, ctrl a d puts me back to the normal prompt because thats the last place I was. Is there any way to make the script menu be a screen session as well? Like I could type screen -r Minecraft-Script, and it would take me to the script menu.
     
  12. Offline

    PierreLouis

    That's how it works in 1.0. :)

    Because of school I can't work as much on it anymore. Here's a preview if you want (don't forget 'chmod +x').
    Make a complete new directory for this script, execute it until it fully works, and then copy your stuff, it could mess something up, I hope not, but it's possible.
    The schedule won't fully work, so don't use it. The rest should be fine, if you find bugs, please tell me and I'll fix those!
    Also if you detach and reattach, you'll only get the prompt, but can switch screens to view the log, and go back with 'Ctrl + A - N'.
     
  13. Offline

    gustebeast

    Ya cause currently, for some reason, when I close the ssh prompt the server crashes after ~2 minutes. I cant disconnect from the script prompt without it shutting down.
     
  14. Offline

    PierreLouis

    I'll test the script via ssh then.
     
  15. Offline

    gustebeast

    I used to use a mac server so I was just vnc'ing into it and left the prompt open. Now I'm on linux so I have to use ssh

    also, can you test it through a non-root user? When I run it under a non-root user it throws a bunch of errors like "cant update".

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  16. Offline

    A520

    Ok, I have an idea how to come out of the preview server without Ctrl + a + d
    In Linux you can execute two instructions simultaneously by using & between commands, I have something like this in the script during the download progress is displayed in windowed mode.
    You can try to add something like this after the call to preview
    Code:
    & whie:
    to
    if [tail / minecraft_directory / server.log | grep "command_for_exit" = "comand_for_exit" > /dev/null]
    screen "command to quit"
    exit 1 // to quit loops
    else
    sleep 1 / / sleep because it will be wtle worked endlessly and can slow down the system
    fi
    done
    OR
    Code:
    & if [tail -f / minecraft_directory / server.log | grep "command_for_exit" = "comand_for_exit" > /dev/null]
    screen "command to quit"
    fi
    
    In this way, without any knowledge of Java can solve problems such as leaving the preview back to the menu.

    Try run
    Code:
    screen -dmS test top
    , close ssh terminal, re-connect after ~5 minutes and run
    Code:
    screen -rx test
    , if you can connect to screen and see runing "top" is all right with program if you cant connect to screen sessions you must install screen
    Code:
    apt-get install screen
    , in another case, try downloading the latest version of the script

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  17. Offline

    gustebeast

    oh thats smart, so it looks at the end of the server.log file to check for an executed command like "script"

    Also A520, screen works fine for me, its just that the script menu doesnt run in a screen session. I cant connect to it because it doesnt exist. The only screen session available is the one for the minecraft server.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  18. Offline

    PierreLouis

    The way it works in 1.0 is I have 2 screen sessions:
    • The server (java)
    • The server view + menu (split)
    The server view uses "tail -f server.log" to print the log on screen.
    When I call the exit function, script kills tail and exits (simplified code):
    Code:
    PIDOf() {
      #
      ps axc | awk "{if (\$5==\"$1\") print \$1}"
    }
    Exit() {
      kill $(PIDOf tail)
      exit
    }
    
     
  19. Offline

    gustebeast

    Ok, theoretical situation...

    I run the new version of the script and I am brought to the script menu. How do I do the following...

    1. Get to a server output where I can run commands like "say hey guys!"

    2. Get back to the script menu from that server output

    3. Get out of SSH on my local computer without having the server close on the host computer.
     
  20. Offline

    A520

    Ok, if you turn off the console without leaving the screen session and the server dies. You should do a simple test. Run two consoles, on the first run
    Code:
     watch -n 1 screen -ls 
    . On the second consoles connect to the game server using the command
    Code:
     screen -rx session_name 
    session_name, you can read from the first console.
    Set both windows so you could see everything and kill the second consoles.
    If the server will still live on the first console will keep the same value, then the script is to be improved, if not, then tell me which user running the server and which user you use to logging to server

    I do not know if it will work, if we use
    Code:
     tail -f XXX 
    then we can not go out except by Ctrl + C

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  21. Offline

    PierreLouis

    "kill" sends the interrupt signal to a process, which is the equivalent of pressing Ctrl - C.

    Instead of pressing Ctrl + A - D, use "close", the script will kill itself, but leave the server running. Then when you want to connect again, just run the script, it'll see the server is running, and connect back to it! :)
    I'm sorry I didn't think of telling you I had written that code!
     
  22. Offline

    gustebeast

    will it still do things like autmatic restarts while closed?
     
  23. Offline

    PierreLouis

    No. The script stops. Only the server is left.
    I'll make it an option though. :)
     
  24. Offline

    gustebeast

    Ya cause I want to have automatic restarts, but I cant leave my ssh prompt open all day.

    A note on backups...
    I want to have my server restart every day at 12 midnight. Since the world is in ram disk I can no longer use a plugin like MineBackup, so I have to rely on the script. I want the script to automatically backup the world after the restart at 12 midnight. That by itself seems simple, just make it backup after any restart. Unfortunately that isnt sufficient.

    I sometimes need to restart the server to add plugins or remove them, when doing this I want the restarts to be as fast as possible as to keep downtime to a minimum. Backing up takes a while so having it backup during these testing restarts is bad. Also, I dont like to have too many backups for one day because it's fairly useless and pushes out backups I need.

    Heres my solution. Have an option for backup during restart, BUT have a little prompt come up in the script like so...
    (user types /restart)
    Stopping Server...
    Backing up Worlds, type 'cancel' to stop the process
    Starting Server...

    If you are doing a test restart that you want to expediate, you just type 'cancel' into the prompt, this stops the backup process and skips right to starting up the server.

    Another Note:
    What are you doing with the 'tail' thing. Is that to print out the server log, or to scan for a command issued? If its to print out the server log, thats not very helpful because the main reason for seeing the log is so you can type consol commands.
     
  25. Offline

    gustebeast

  26. Offline

    PierreLouis

    Yes, I 've started to code your requests, but didn't update because I don't have that much time, so I spent it working on the script. ;)

    tail is used to show the content of server.log on the screen. I can't run the server above the menu because I would have to kill it to go back to the prompt, that's why I use tail. I can kill tail, but not the server, and get back to the prompt with the server in the background.
     
  27. Offline

    gustebeast

    From this tail screen, can you issue consol commands?
     
  28. Offline

    PierreLouis

    No, tail is just a utility used to display the content of server.log. It has no other use.
     
  29. Offline

    gustebeast

    How would I enter commands? What I like to do normally when I'm on the go is SSH in, then type in /who and then /mem to see how the server is running, occasionally I might want to restart it.
     
  30. Offline

    PierreLouis

    Using the bottom part of the screen where you can type; the top is tail, and the bottom is the main script that sends the commands, etc. The schedule part is managed in a complete different screen, that doesn't need to be stopped when you go back to the prompt.
     
Thread Status:
Not open for further replies.

Share This Page