Project Zomboid

Project Zomboid

Update PLZ
51 Comments
Syn 3 Apr @ 6:51am 
To configure the server to automatically restart after a shutdown, locate the "StartServer32.bat", "StartServer64.bat", or "StartServer64_nosteam.bat" file. Open the batch file in an editor and replace the "pause" command at the end with:

call "%~f0"

Make sure to copy and paste it exactly as shown. This line will enable the server to automatically restart whenever it detects that it has gone offline.

Hope that helps.
Daimyo 12 Nov, 2024 @ 6:00pm 
Appears to work
MarujaKing 1 Jun, 2024 @ 7:03am 
IS this mode required when not playing muti or with friends?
Zefirr 9 Jul, 2023 @ 12:21pm 
same . does it work please ?
ripmaikel SKINS 12 May, 2023 @ 11:45pm 
it works?? i actually need to do a auto restart system for a linux dedicated server
Methylenedioxymethamphetamine  [author] 11 May, 2023 @ 4:53am 
Hello yes it only shuts down the PZ application not the machine - would be kind of crazy if they gave mod developers access to do that lol
TancredTerror 11 May, 2023 @ 2:47am 
Hello Billy !
Thank you for the Mod
Do you confirm that your mod shudown the PZ application and not the server machine ?
Because when you say it shutdown the server, both could be understoof.
Thank you for your answer ;)
해솔 6 Mar, 2023 @ 5:21pm 
Mod id UpdatePlz180 = 3hour?
can i 3hour update use?
UdderlyEvelyn 2 Sep, 2022 @ 7:22am 
Feel free to mimic the delay feature to fix the data loss in your mod, or just point people to my mod if you'd rather wash your hands of maintenance. Thanks again for letting me base mine on your code!
UdderlyEvelyn 2 Sep, 2022 @ 7:21am 
I made my version, you can find it here:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2844315442

I fixed the message sending to be compatible with chat mods (the message table was missing some function stubs), added sandbox options for the restart delay and how often to poll the workshop, as well as a new (also configurable) feature to add a delay between saving and quitting to avoid the data loss issue.
UdderlyEvelyn 25 Jul, 2022 @ 10:41am 
Yeah I found that already, was seeking permission since I'd have to upload a copy. xD

I assume that you're OK with it since you're pointing me at the bit of code. Turns out our current host doesn't support modifying the script to make it auto-restart, so we'll have to muddle through with manual restarts until they implement that.
UdderlyEvelyn 24 Jul, 2022 @ 3:47pm 
Should be a way to configure the frequency of checks. For a large server, checking every minute is *quite excessive* and causes a lagspike since we run 325 mods at present. If you aren't interested in making this a thing would it be OK for me to spin off a copy (with credit and link given) that is tweaked for my scenario?
Z 20 Jul, 2022 @ 9:03am 
Hello, thanks for the mod! :steamthumbsup:
Is it possible to make the mod save before shutting down the server?
Also is it possible to make the notification broadcast from /all so the discord bot announce it on discord? (or directly to discord)
Methylenedioxymethamphetamine  [author] 13 Jun, 2022 @ 3:10am 
@Apollo Awesome, I could easily integrate it into the current mod if you open a pull request on GitHub :D
@Mihalich Yes it does, not sure why it isn't showing for you if you're not seeing it.
Apollo 13 Jun, 2022 @ 1:12am 
As-per my previous comment I was hoping for a log message only option. I ended up just creating my own mod to do that using code from your mod. Hope that's ok. My mod workshop ID is 2820127528
Mihalich™ 12 Jun, 2022 @ 11:37am 
@infanticide gaming
Listen, does the mod have a server restart notification in the game itself?
The thing is, I've seen this message a couple of times (in red letters on screen and in chat), but most of the time my server just goes on reboot, kicking everyone out.
Mihalich™ 11 Jun, 2022 @ 9:31pm 
:cherrypie::cherrypie::cherrypie::cherrypie::cherrypie::cherrypie::cherrypie::cherrypie:
Thank you! Thank you!
Thank you! Thank you!
Thank you! Thank you!
Thank you! Thank you!
Thank you! Thank you!
:cherrypie::cherrypie::cherrypie::cherrypie::cherrypie::cherrypie::cherrypie::cherrypie:
Apollo 7 Jun, 2022 @ 1:32am 
Could an option be added that just prints a message to log that the server needs to be restarted, without actually shutting down the server?
Odysia 3 May, 2022 @ 9:29am 
Hello. I am from the same server as Audie, Ravenrose. Recently out server hasn't been getting auto restart warnings. Any idea what may be causing this and how to fix it? Is it maybe a setting we accidentally turned off? It worked when we first added the mod.
Outlaw 24 Apr, 2022 @ 6:11pm 
We get it our server too. I generally tell everyone to log out before the update. Once everyone logs out from a chunk I believe it saves it. Could I possibly suggest another mod? An AFK check/kicker. On weekends we usually have several people...um.. pass out lol.. and wake up dead. Or people AFK'ing during our events taking up space. Currently theres only one mod and I don't believe it works.
Methylenedioxymethamphetamine  [author] 12 Apr, 2022 @ 7:02pm 
I am going to directly ask the devs if they have a solution. As far as I can tell there is no other way to save the game. You can't even execute server commands (like quit) from a mod unfortunately.
batsonline.ttv 12 Apr, 2022 @ 8:23am 
We are also noticing items disappearing and progress being rolled back significantly after updates. Is there a way to fix this? We are currently using the 15 minutes warning version, and have a daemon to restart the server.
paTaNiNHo 8 Apr, 2022 @ 2:37am 
If the server has more active slots (64 slots), saving takes arround 2100ms and our players can see up to 10 min. items roll-back, when the server shutdown. So maybe there is some bug with the saving procedure...
ttv: mitaagon 2 Apr, 2022 @ 12:34pm 
Last 1 minute did not save like 2 hours progress, saving just player positions but saved items on containers are lost
Methylenedioxymethamphetamine  [author] 2 Apr, 2022 @ 12:29am 
Hello, what data is lost?
ttv: mitaagon 31 Mar, 2022 @ 11:01pm 
Is there a solution to data lost when rebooting the server on a workshop update?
SmugJack 30 Mar, 2022 @ 11:21am 
You are correct I had a daemon not executing properly. It seems something else is causing my item duplication and partial resetting characters. But I don't think it is caused by this mod.
Methylenedioxymethamphetamine  [author] 29 Mar, 2022 @ 3:29pm 
I don't know what you mean by pausing, you probably don't have a daemon that automatically restarts the server when it quits. Those assertions come from Steam and will print when you quit anyway, it's not caused by the mod.
Methylenedioxymethamphetamine  [author] 28 Mar, 2022 @ 5:37pm 
Also please, what data was lost exactly?
Methylenedioxymethamphetamine  [author] 28 Mar, 2022 @ 5:36pm 
I have made an experimental change to resolve the issue
It will wait 2 ticks before quitting
Yell420 28 Mar, 2022 @ 12:57pm 
i had to remove the script aswell due to data loss, Its closing the process too fast from what i can tell
Methylenedioxymethamphetamine  [author] 28 Mar, 2022 @ 8:25am 
Could you elaborate on what exactly doesn't save properly?
Methylenedioxymethamphetamine  [author] 28 Mar, 2022 @ 7:49am 
As far as I can tell, the saving is not asynchronous or done in a different thread. When saving from Lua it should block the main thread until saving is complete (which is then when UpdatePLZ quits the game) so I am not sure what would cause that.
Flandre Scarlet 26 Mar, 2022 @ 12:14am 
is this mod can auto restart server , will be the best mod , but still great work
Yell420 25 Mar, 2022 @ 9:56am 
Working flawlessly, thanks for the update!
R4ZH0R 25 Mar, 2022 @ 6:01am 
Hey, If it works flawlesslyand keep doing so, chance of being the mod of the year.
Awesome job
Methylenedioxymethamphetamine  [author] 24 Mar, 2022 @ 10:51pm 
Yeah it does display a few server messages (and counts down in reasonable intervals)
Outlaw 24 Mar, 2022 @ 9:58pm 
Does the new versions do a /servermsg stating that an update is found, server restarting. Or does it just shut down after the time period
Methylenedioxymethamphetamine  [author] 24 Mar, 2022 @ 6:19pm 
Done, let me know if there are any issues
Methylenedioxymethamphetamine  [author] 24 Mar, 2022 @ 12:38pm 
It is trivial to make, don't worry, I will make it soon
Yell420 23 Mar, 2022 @ 10:07pm 
Thanks for this mod, if you could make a separate version that restarts regardless of people being in the server that would be great.
Outlaw 23 Mar, 2022 @ 3:58pm 
And to also do it whether players are in the server or not? My server host has a scheduled tasks feature to check, but gives absolutely no warning that it is restarting.
Outlaw 23 Mar, 2022 @ 3:57pm 
Is there anyway to have this mod or create something similar to operate like this:
Check for game/workshop mod updates, if theres an update, announce using servermsg "Update detected, server restarting in 15 minutes" and then again at 10, 5, 1, then restart?
Kagoule 21 Mar, 2022 @ 1:39am 
Thanks, for those interested, here is my batch:
@echo off
:Restart
start "PZ" /wait "G:\Games\...\StartServer64.bat"
goto Restart
Methylenedioxymethamphetamine  [author] 20 Mar, 2022 @ 9:40am 
You can use a simple Batch script to achieve that, Google "windows batch restart after exit"
Kagoule 20 Mar, 2022 @ 7:43am 
Can anyone using this mod can explain how to automatically restart a dedicated server on Windows 10?
FR_Alucard88 15 Mar, 2022 @ 6:03am 
Thank :)
Methylenedioxymethamphetamine  [author] 15 Mar, 2022 @ 5:53am 
Pterodactyl, TCAdmin, etc. I believe are capable of restarting the server automatically if it crashes/shuts down.
FR_Alucard88 15 Mar, 2022 @ 5:17am 
Hello, " so please make sure you are using a daemon that will automatically restart the server when it shuts itself down " do you have an example ?