#End server bat through scheduler?

16 messages · Page 1 of 1 (latest)

tall solar
#

I have a little server completely dedicated only to running my PZ server for my friends and I.
Unfortunately, every day it becomes unresponsive and needs to be restarted.
I'm looking for a way to set up a .bat for the windows task scheduler to end the server every day at a certain time. I already have the scheduler set up to run the server at a certain time every day, but it ends up just doing a duplicate of the process.

Could anyone who has any experience with this sort of thing give me some quick code I could slap into a .bat and call it a day?

Currently my server "starts" at 10AM every day, I'd like to have it quit out at 9:58AM

wooden garnet
#

you'll likely want to use RCON to send a quit command to kill the server properly, but if you really just want to end it, you can use Taskkill like Taskkill /IM java.exe /F

#

or for powershell you can use 'Stop-Process' cmdlet

#

but rcon quit would be better because it would save first

tall solar
idle lava
#

If the server is unresponsive will it take the rcon command?

wooden garnet
#

you should first get the pid of your current cmd.exe though and kill all the other ones

#

otherwise you might kill your killer 😐

#

i guess you could also set the window title to something specific to kill

#

in your server batch file you can set windowname to be 'zomboid' or something and then when you taskkill just target windowtitle zomboid

wooden garnet
tall solar
wooden garnet
#

Is that the name of the other batch files window?

#

You have to set the window title name in your server launch batch