0

I run a Minecraft server and I have an issue when the power goes out and the UPS is getting low on battery power, it sends its shutdown command (as expected) to Windows but Windows shuts down without giving the Minecraft server time to close via a script. I've tried using shutdown scripts to shut down the server, which works with no issues by itself, buy when Windows shuts down it seems to ignore the script or not give the script adequate time to complete (tried using task scheduler and gpedit.msc for the script). If there's a way or workaround to delay a shutdown and give the script adequate time to run in Windows that i'm not aware of or with 3rd party software please let me know, thanks!

(Unfortunately, my ups doesn't support running scripts natively)

William
  • 71
  • 5
  • https://stackoverflow.com/questions/67081085/how-to-use-powershell-to-run-some-code-upon-system-shutdown maybe this can help – Michael Fulton Mar 11 '23 at 04:02
  • This doesn't fix my issue since my issue is with Windows 10 shutting down and not giving enough time for a Minecraft servers shutdown script (triggered @ shutdown) to complete. I keep wondering why there's an option in the group policy editor for shutdown scrips along side startup scripts but Windows doesn't wait at all, it just shuts down and the script cannot complete, unless I'm missing something. – William Mar 11 '23 at 04:26
  • Do any of the options discussed in this answer help? https://stackoverflow.com/a/34701205/5013141 – Michael Fulton Mar 11 '23 at 04:54
  • I'm just going to return the UPS I'm currently using and am going to get this one instead https://www.amazon.com/gp/product/B002RCNX8K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 its the same price and it logs power events to windows event viewer so I can run a bat script triggered by one of those events to close my server and then at the end do "shutdown -s -t 0" TY for the help anyway – William Mar 11 '23 at 07:12

0 Answers0