How to get memory usage of a Minecraft server?

9,696

That's because the pid that you're searching is the pid of screen. The minecraft jar should have a ppid (parent pid) of the screen, so run:

ps -el | grep <pid of screen>

you should get something like:

root@ubuntu:~# ps -el | grep 26270
5 S     0 26270     1  0  80   0 -  6797 poll_s ?        00:00:00 screen
4 S     0 26271 26270 49  80   0 - 1026274 futex_ pts/0  00:00:15 java

where 26271 is the pid of the process inside of the screen

Share:
9,696

Related videos on Youtube

NickoLimited
Author by

NickoLimited

Updated on September 18, 2022

Comments

  • NickoLimited
    NickoLimited over 1 year

    I am creating a Minecraft control panel at the moment and having trouble by getting the memory usage of the process.

    My current process:

    • launch the server in a screen
    • get the pid of the screen
    • fetch amount of ram with command ps -p <pid> -o %mem

    The error is, that it is always showing me a usage of 0.0 KB

    I'm using Debian Linux.

    Any ideas?

    • Fabo.sk
      Fabo.sk about 9 years
      Have you tried using 'top' command?
    • Tillman32
      Tillman32 about 9 years
      Why would you want to report mem usage off of the screen pid, and not the Minecraft server pid? @Fabo.sk - Top is great as an end user display, but not great for use in scripting.
    • NickoLimited
      NickoLimited about 9 years
      @Tillman32 but how do I get the Minecraft server pid? I was looking for about 4 hours now..