MegaMek Discussion Board
How to administer a MegaMek server? - Printable Version

+- MegaMek Discussion Board (https://forum.megamek.org)
+-- Forum: General Category (https://forum.megamek.org/forum-3.html)
+--- Forum: Dedicated Servers (https://forum.megamek.org/forum-12.html)
+--- Thread: How to administer a MegaMek server? (/thread-1012.html)



How to administer a MegaMek server? - Predatorian - 04-28-2013

I am running a dedicated server for a few friends of mine, and I was wondering if there as anyway to administer it from the commandline if I started the server on a Linux platform via commandline?
Would I also be able to save my current game on the server, or would it just be that everyone in the game would have to make a save copy, and then just load the right game?


Re: How to administer a MegaMek server? - Taharqa - 04-30-2013

Yes, you can run a server on a linux box. I do it all of the time. To start it up, I use the command:

Code:
nohup java -jar MegaMek.jar -dedicated -port 2346 &

That will start it up on port 2346. You will of course have to deal with port forwarding and firewalls yourself.

When you save a game via the /save command within MegaMek, it will be saved to the server itself. You can load that game directly from the command line the next time you start up the server with:

Code:
nohup java -jar MegaMek.jar -dedicated -port 2346 savegames/name_of_save.sav &



Re: How to administer a MegaMek server? - Predatorian - 04-30-2013

(04-30-2013, 03:04 PM)Taharqa link Wrote:When you save a game via the /save command within MegaMek, it will be saved to the server itself. You can load that game directly from the command line the next time you start up the server with:

Code:
nohup java -jar MegaMek.jar -dedicated -port 2346 savegames/name_of_save.sav &

Awesome! I'll be sure to edit my startup scripts to include the 'nohup' and the savedgame option. Could you also load a saved game from within the client when connected to the server, for those people who are not the server administrators?


Re: How to administer a MegaMek server? - Taharqa - 05-06-2013

Yes, you can do that with the /load command in MegaMek, but I think the savegame will have to be on the server. You can do /listSaves to see what saves are available. One of the side effects of that command is that it will bump you off the server, so you have to reconnect.


Re: How to administer a MegaMek server? - Predatorian - 05-07-2013

That I can live with. My users will have to also.


Re: How to administer a MegaMek server? - Hythos - 08-11-2014

I'm currently working towards setting up my 2003R2 Server; a week ago, I was able to run MegaMek - then it patched.  Ever since, it's continuing to give me Java errors.
Rolling back& uninstallig patches haven't worked, nor has applying the update that's supposed to fix it. I'm going to try removing and reinstalling Java again... Otherwise I may need to rebuild it.

Has anyone else run into a similar circumstance?
Dare I switch to a Linux didtribution instead? I haven't played with Linux for 15 years...


Re: How to administer a MegaMek server? - ralgith - 08-11-2014

(08-11-2014, 03:24 AM)Hythos link Wrote:I'm currently working towards setting up my 2003R2 Server; a week ago, I was able to run MegaMek - then it patched.  Ever since, it's continuing to give me Java errors.
Rolling back& uninstallig patches haven't worked, nor has applying the update that's supposed to fix it. I'm going to try removing and reinstalling Java again... Otherwise I may need to rebuild it.

Has anyone else run into a similar circumstance?
Dare I switch to a Linux didtribution instead? I haven't played with Linux for 15 years...

Yes. http://www.centos.org/

As for Windows Server... I really don't know. You haven't said what versions of Java or anything are being dealt with Wink Not to mention that 2003 is well past it's prime, even 2003R2, what with 2008, 2008R2, and 2012 all being out now. But meh, they're expensive crap for most uses. I have CentOS on all of my servers.


Re: How to administer a MegaMek server? - Hythos - 08-11-2014

Thanks, Ralgitg.

I've been using the latest 32-bit Java; I nearly mentioned before.


Re: How to administer a MegaMek server? - ralgith - 08-11-2014

(08-11-2014, 10:58 AM)Hythos link Wrote:Thanks, Ralgitg.

I've been using the latest 32-bit Java; I nearly mentioned before.

You need to be more specific. Saying "latest 32 bit java" means nothing. Is it Oracle's Java 7, Oracle's Java 8, OpenJDK's Java 7, OpenJDK's Java 8?

Last I checked (a few days ago), the default for Oracle was still Java 7, but the default for OpenJDK was already Java 8.


Re: How to administer a MegaMek server? - Hythos - 08-11-2014

1.7.0_67, 32bit.

Attempts to run the executable alone, and I get the normal "Could not create the Java Virtual Machine" error...

SO, I then tried to direct the JAVA executable to open the EXE-file through a batch-file:  (this was a shot in the dark, but it seemed logical)
"D:\Program Files\Java\jre7\bin\java.exe" -incgc -xmx1g -jar e:\MegaMek\megamek.exe -dedicated -port -2346

and it started...

configuring with -xmx2g  returns "error occurred during initialization of VM - could not reserve enough space for object heap"
I guess I'll work that one out later.


Now, I just have to create a server-config and copy it to the servers' directory.


Re: How to administer a MegaMek server? - ralgith - 08-11-2014

Yes, it sounds like you definitely need to move to Linux Wink

Also, I've found that, due to the RAM limits of 32 bit java (which is I think what you're hitting), it is best to run dedicated servers using 64 bit java.


Re: How to administer a MegaMek server? - Xenon54z - 08-11-2014

What did you mean:
(08-11-2014, 03:24 AM)Hythos link Wrote:a week ago, I was able to run MegaMek - then it patched.
Did MegaMek patch itself? Or did java patch itself?

If it was java patching itself, then I echo that you should dump 32 bit (unless you are still on a 32 bit operating system) and go with the 64 bit version of java.

If it was MegaMek, then I have no idea what you mean since MegaMek doesn't "patch." New versions should be "installed" or extracted into their own directories and not on top of the old version. Only user added data, like customs, needs to be moved/copied to the new MegaMek directory.

However, if you happened to have solved your problem already and neither of these above suggestions apply to you then good. Smile


Re: How to administer a MegaMek server? - Hythos - 08-11-2014

(08-11-2014, 05:52 PM)Xenon54z link Wrote:What did you mean:
[quote author=Hythos link=topic=1213.msg11243#msg11243 date=1407741871]
a week ago, I was able to run MegaMek - then it patched.
Did MegaMek patch itself? Or did java patch itself?

If it was java patching itself, then I echo that you should dump 32 bit (unless you are still on a 32 bit operating system) and go with the 64 bit version of java.

If it was MegaMek, then I have no idea what you mean since MegaMek doesn't "patch." New versions should be "installed" or extracted into their own directories and not on top of the old version. Only user added data, like customs, needs to be moved/copied to the new MegaMek directory.

However, if you happened to have solved your problem already and neither of these above suggestions apply to you then good. Smile
[/quote]

Hehe yeah, I could see that may seem misleading Wink
It was JAVA that auto-patched.
I only have a 32-bit Win2003Ent license from years back; I've stuck it out 'cause it's a quad-core Opteron and it still serves it's purpose as a file/light-ap server; though I do have a spare drive on which I'd be willing to try the Linux distro.

It's currently chugging through 2 Clusters each of Clan Wolf vs Clan Steel Viper, 530kBV vs 515kBV, 100x100map...


Re: How to administer a MegaMek server? - ralgith - 08-11-2014

Instead of trying to manually pass memory parameters, try adjusting the megamek.l4j.ini file. It contains the memory parameter to pass. I'm not sure it can be correctly overridden with the command line as you tried doing.


Re: How to administer a MegaMek server? - Hythos - 08-12-2014

(08-11-2014, 11:34 PM)ralgith link Wrote:Instead of trying to manually pass memory parameters, try adjusting the megamek.l4j.ini file. It contains the memory parameter to pass. I'm not sure it can be correctly overridden with the command line as you tried doing.
OK; I have the .ini set to 2g, and removed the command-line flag;
I've read through all(I think all?) of the DOC files provided with MM + MHQ - and if it pertains to a server-config, I'd like to know more about non-GUI bots...

(Unrelated) - my 1.18mil BV battle has to be 'refreshed' every hour via /replacePlayer.  LOL I know it's asking a lot for it... hehe


RE: How to administer a MegaMek server? - atsalmon - 03-01-2020

(04-30-2013, 03:57 PM)Predatorian Wrote:
(04-30-2013, 03:04 PM)Taharqa link Wrote:When you save a game via the /save command within MegaMek, it will be saved to the server itself. You can load that game directly from the command line the next time you start up the server with:

Code:
nohup java -jar MegaMek.jar -dedicated -port 2346 savegames/name_of_save.sav &

Does this still work?  I am running an Ubuntu server, and the saved game does not load when using this command.  I only get the port, but not the saved game.  I am running MegaMek 44.



RE: How to administer a MegaMek server? - Hammer - 03-01-2020

.44 is a pretty old version, and I vaguely remember us fixing some save game stuff around dedicated servers. But don't remember when.

I'd try with 46.1 the current stable and if it doesn't best to open a bug report (links in my sig)