Graceful Shutdown for live server
-
So, I have a server that's running fine with the current IW4MAdmin installed.
However, I can't leave this server running for days at a time and I want an automated way to shutdown the server gracefully, be it after a set time or on map rotation.
Is this possible with either server commands or IW4MAdmin commands?
Thanks!~
-
Ive looked into this for BO1 since after like 30 mins of inactivity the session seems to just fail out of no where and throws the session error.
You could use windows provided task schedular to start the !start bat file and then after a period of time run another bat to shutdown the !start bat and map restarter bat file and you can set it to cycle every x amount for x amount of days/months/years whatever.
this should also be possible with windows powershell and also bat alone.
-
this will work but it shuts down all cmd.exe/command prompt windows
save this in .bat:
Echo on
:serverstart
cls
start C:\Users\Weedliketoosmoke\Desktop\plutonium-bo2-server!start_zm_server.bat
timeout /t 10
taskkill /F /T /IM cmd.exe
goto serverstartAlternative:
if u want to start the server back up after x amount of secondsdownload this and put in the same server files as your !start bat: https://github.com/npocmaka/batch.scripts/blob/master/hybrids/.net/getCmdPID.bat
Echo on
:serverstart
cls
start C:\Users\Weedliketoosmoke\Desktop\plutonium-bo2-server!start_zm_server.bat
timeout /t 10
call getCmdPID
set "current_pid=%errorlevel%"
for /f "skip=3 tokens=2 delims= " %%a in ('tasklist /fi "imagename eq cmd.exe"') do (
if "%%a" neq "%current_pid%" (
TASKKILL /PID %%a /f >nul 2>nul
)
)
for /f "skip=3 tokens=2 delims= " %%a in ('tasklist /fi "imagename eq plutonium-bootstrapper-win32.exe"') do (
if "%%a" neq "%current_pid%" (
TASKKILL /PID %%a /f >nul 2>nul
)
)
goto serverstart -
Thanks, but I was curious if there was anything within Plutonium server commands or IW4MAdmin commands to achieve this end. I suppose I'll just run a say command on my server then run a batch script that shuts down the entire computer in 15 minutes. Not near as pretty, but I guess it'll do.
-
ghlegend195 you can send "quit" to the server via iw4madmin
!rcon quit
but you'd still need to write a plugin for it to automatically do this after x time. There is no such functionality integrated.
-
You could use my plugin for IW4m-Administrator to automate it. Just set-up the say message and send a quit a few minutes later.