mark2devel / mark2

Minecraft Multi Server Wrapper Written in Python with Twisted; Pull Requests HIGHLY Encouraged, Collaborators Needed Discord: https://discord.gg/zymJygHNpv
Other
208 stars 44 forks source link

Whats the best way to update a server jar for production without stopping/starting & using restart? #167

Closed TomLewis closed 2 years ago

TomLewis commented 2 years ago

I have an autoamted restarted every day, If I download a new PurPur, I want to be able to put it somewhere that itll auto update after restart, Ive read that just deleting the old JAR while its still running isnt good practise, and overwriting it is the same thing.

Can this be done with mark2 as its a wrapper? Seems like a job mark2 should do.

When its picking a jar it should be looking for the highest filename number, that would be simple enough.

Column01 commented 2 years ago

mark2 has a .reload command which rescans the mark2.properties if you want to hard code the file name and a .jar command which tells mark2 to switch to the new jar file it finds following your pattern in the mark2.properties file for your jar file.

What you could do is:

  1. Make sure your mark2.properties jar pattern uses a wildcard like purpur*.jar where purpur-10.jar and purpur-11.jar would be examples of the updated jar name
  2. Update your jar file by downloading the new one and placing it in the server directory
  3. Open mark2 and run .jar to tell mark2 to change jars at the next restart
  4. Delete the file the old jar file the next day or whenever the server restarts next

There will be a message in the console telling you the new jar name it will switch to for a sanity check and when it restarts next, it will change to that file.

TomLewis commented 2 years ago

Open mark2 and run .jar to tell mark2 to change jars at the next restart

TIl there is a .jar command!

is it safe to delete the old jar while its still running?

Column01 commented 2 years ago

No, the server must be restarted first

On Thu, Mar 10, 2022, 8:21 AM Tom Lewis, @.***> wrote:

Open mark2 and run .jar to tell mark2 to change jars at the next restart

TIl there is a .jar command!

is it safe to delete the old jar while its still running?

— Reply to this email directly, view it on GitHub https://github.com/mark2devel/mark2/issues/167#issuecomment-1064053231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKMHOMJZEFA7E4PGD3OPWDU7HZOLANCNFSM5PG7WBRA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>

TomLewis commented 2 years ago

Just tried running .jar on my test server thats on the same box as my survival, which made my survival restart somehow? server might have crashed: not accepting connections or wrong port is being pinged. -- restarting. luckily it was quiet.

Column01 commented 2 years ago

That's unrelated to .jar and probably means it froze or something and its just a coincidence.

TomLewis commented 2 years ago

Nope, it was the reason! The server was not under stress and there were no errors from any plugins or a crash report, and it happened right after I run that command.