Crash Recovery

I’ve noticed a few servers have a crash recovery script where if the server crashes, when it starts up again your entities will still be there, doors owned and such.
Can anyone point me in the right direction to either the script itself or how I could go about coding it.

Any help is appreciated.

here is a batch file from the gmod wiki


@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds, close the srcds window and type Y depending on your language followed by Enter.
title Server Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -console -game garrysmod +map gm_construct +maxplayers 16
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds