SRCDS Steam group


[Windows] Scheduling your server to restart automaticly
#1
In this tutorial you will learn how to schedule your Source Dedicated Server tool to restart at a given time every day [Windows Only]

You will need Watchdog to automatically open srcds.exe, and a small program called Kill and a script called Kill.bat. By running kill.bat, it forces the process srcds.exe to close. When srcds.exe closes, Watchdog will open it again.

1. Download the essential files here:
.zip   ServerRestart.zip (Size: 27.17 KB / Downloads: 252)
and extract them to your server directory ex. C:/Srcds
Kill.exe - A process killer, used to close Srcds.exe
Kill.bat - A simple batch file i wrote up to end Srcds.exe
Watchdog.bat - A batch file that restarts Srcds if it closes
Srcdsfpsboost.exe - A non-essential tool that boosts the FPS on your server, i use it, you should too

2. Edit watchdog.bat to match your command line
Right Click on Watchdog.bat and on the 8th line you should see
Code:
start /wait srcds.exe -game cstrike -console +map de_dust2 -maxplayers 16 -autoupdate +port 27015
or something similar.
Edit the code after srcds.exe to match your server's command line.

3. Open the Start Menu and open Control Panel

4. Double-Click on Scheduled Tasks

5. When the Scheduled Tasks window opens, double click on Add Scheduled Task, this will open the Scheduled Task Wizard

6. Click Browse on the wizard and navigate to your server directory and select kill.bat

7. Name the task kill and make sure that Perform This Task is set to Daily and click Next

8. Set the time that you want your server to restart, preferably a time when the server is empty. Again, make sure that Perform This Task is set to 'Every Day'. Also, make sure that Start Date is set to the current date

9. Click Next and input your password in both windows and click Next

10. The wizard will confirm the settings and then press Finish

Usage:
Run Watchdog.bat from your server directory, this will start your server with the command line you set. Also, run srcdsfpsboost.exe to increase server's framerate.

Congratulations! your server will now restart everyday at the time you set

Edit: This will only work on administrator accounts with a password, you cannot schedule tasks with a blank password
Reply
#2
gamegod432 Wrote:In this tutorial you will learn how to schedule your Source Dedicated Server tool to restart at a given time every day [Windows Only]

You will need Watchdog to automatically open srcds.exe, and a small program called Kill and a script called Kill.bat. By running kill.bat, it forces the process srcds.exe to close. When srcds.exe closes, Watchdog will open it again.

1. Download the essential files here:
and extract them to your server directory ex. C:/Srcds
Kill.exe - A process killer, used to close Srcds.exe
Kill.bat - A simple batch file i wrote up to end Srcds.exe
Watchdog.bat - A batch file that restarts Srcds if it closes
Srcdsfpsboost.exe - A non-essential tool that boosts the FPS on your server, i use it, you should too

2. Edit watchdog.bat to match your command line
Right Click on Watchdog.bat and on the 8th line you should see
Code:
start /wait srcds.exe -game cstrike -console +map de_dust2 -maxplayers 16 -autoupdate +port 27015
or something similar.
Edit the code after srcds.exe to match your server's command line.

3. Open the Start Menu and open Control Panel

4. Double-Click on Scheduled Tasks

5. When the Scheduled Tasks window opens, double click on Add Scheduled Task, this will open the Scheduled Task Wizard

6. Click Browse on the wizard and navigate to your server directory and select kill.bat

7. Name the task kill and make sure that Perform This Task is set to Daily and click Next

8. Set the time that you want your server to restart, preferably a time when the server is empty. Again, make sure that Perform This Task is set to 'Every Day'. Also, make sure that Start Date is set to the current date

9. Click Next and input your password in both windows and click Next

10. The wizard will confirm the settings and then press Finish

Usage:
Run Watchdog.bat from your server directory, this will start your server with the command line you set. Also, run srcdsfpsboost.exe to increase server's framerate.

Congratulations! your server will now restart everyday at the time you set

Edit: This will only work on administrator accounts with a password, you cannot schedule tasks with a blank password

When I edit the command line on the WatchDog bat file after the srcds exe I tryed to use my srcds sever command line.
I get a error message "Windows can`t find srcds.exe".
Let me show you what the WatchDog bat file looks like when I edit the command line.
@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds and this script, close the srcds window and type Y depending on your language followed by Enter.
title srcds.com Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe" F:\Program Files\Valve\HLServer\srcds.exe" -console -game cstrike -tickrate 100 +fps_max 1000 -autoupdate +maxplayers 20 +map gg_simpsons_x -heapsize 1048576
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds
I tryed this way & this way & I get the same error.
@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds and this script, close the srcds window and type Y depending on your language followed by Enter.
title srcds.com Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -console -game cstrike -tickrate 100 +fps_max 1000 -autoupdate +maxplayers 20 +map gg_simpsons_x -heapsize 1048576"
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds
[Image: cstrike2-02.png]
Reply
#3
Code:
@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds and this script, close the srcds window and type Y depending on your language followed by Enter.
title srcds.com Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -game cstrike -console +map gg_simpsons_x -maxplayers 20 -autoupdate
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds
That should work as your watchdog.bat file

Also, make sure that watchdog.bat is in the same directory as srcds.exe, or it won't work
Reply
#4
You can get around the having to have the password requirement by right clicking on the scheduled task then hit properties. In the window that pops up, in the lower left-hand corner is an option that says "Run only if logged in." Click that option and hit apply. Then you don't need a password Smile
realchamp Wrote:
Hazz Wrote:Has someone helped you on these forums? If so, help someone else
Mooga Wrote:OrangeBox is a WHORE.
Reply
#5
Thank you for sharing, i did not know that
Reply
#6
gamegod432 Wrote:
Code:
@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds and this script, close the srcds window and type Y depending on your language followed by Enter.
title srcds.com Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -game cstrike -console +map gg_simpsons_x -maxplayers 20 -autoupdate
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds
That should work as your watchdog.bat file

Also, make sure that watchdog.bat is in the same directory as srcds.exe, or it won't work
Thanks GameGod! It works like a charm.
1 more noob question will this Batch file restart the server incase of Crashes?
[Image: cstrike2-02.png]
Reply
#7
I've tried this autorestart script and another similar one, but every time my server crashes I get a pop up message saying "srcds.exe has stopped working", and the server won't restart until I click to close it. This is obviously a problem because I can't be there to click OK every time the server needs to restart. I'm running on Vista. I've searched everywhere for a way to disable this error dialogue but no luck so far. Help. :/
Reply
#8
Lumii Wrote:I've tried this autorestart script and another similar one, but every time my server crashes I get a pop up message saying "srcds.exe has stopped working", and the server won't restart until I click to close it. This is obviously a problem because I can't be there to click OK every time the server needs to restart. I'm running on Vista. I've searched everywhere for a way to disable this error dialogue but no luck so far. Help. :/

Dude,
I know your pain!
Look at my very 1st reply I made 2 GameGod.
In there u will see how I applied my server console command line to the script.
You don`t have ta copy & paste the whole server command line like I did.
Just ta few parts.
Just compair the 2 of em & u will c.
If u still can`t do it on your own u should copy & paste a copy of your WatchDog bat file to this reply & I`ll try 2 fix it 4 ya.
Good Luck Man.


Attached Files
.jpg   [illadn]Ginghax.jpg (Size: 94.93 KB / Downloads: 18)
[Image: cstrike2-02.png]
Reply
#9
I'm sorry, I think I misread the point of this thread. Closing the server at a certain time every day is different and does not yield an error. I'm looking for a way to automatically restart a server after it crashes and generates error dialogue. If anyone knows of a way to suppress this error, I would appreciate any help.
Reply
#10
bucsrno1 Wrote:will this Batch file restart the server incase of Crashes?

The Job of Watchdog.bat is to restart the server when it closes
Kill.bat closes the server so Watchdog can restart it
Reply
#11
Lumii Wrote:I've tried this autorestart script and another similar one, but every time my server crashes I get a pop up message saying "srcds.exe has stopped working", and the server won't restart until I click to close it. This is obviously a problem because I can't be there to click OK every time the server needs to restart. I'm running on Vista. I've searched everywhere for a way to disable this error dialogue but no luck so far. Help. :/

I'm not sure, i've only used kill.bat on an XP machine. It sounds like a problem with vista, and i can't really help you with that.
Reply
#12
gamegod432 Wrote:
bucsrno1 Wrote:will this Batch file restart the server incase of Crashes?

The Job of Watchdog.bat is to restart the server when it closes
Kill.bat closes the server so Watchdog can restart it

The WatchDog Batch file is working so good that the kill Batch file can`t stop it at the scheduled time or manually.
I even tryed to stop it with the kill batch file myself several times.
I have it installed in the SRCDS.exe directory folder along with the WatchDog Batch file which refuses to die.
????????????
Here`s a copy of the Kill Batch file.
kill -f srcds.exe
[Image: cstrike2-02.png]
Reply
#13
bucsrno1 Wrote:Thanks GameGod! It works like a charm.
Up there you said it was working fine...
Are you running Vista? Because i have heard that this does not work under vista.
Reply
#14
gamegod432 Wrote:
bucsrno1 Wrote:Thanks GameGod! It works like a charm.
Up there you said it was working fine...
Are you running Vista? Because i have heard that this does not work under vista.

The WatchDog Batch file is working fine.
I thought that the Kill Batch file was suppose to stop the WatchDog & the SRCDS at a scheduled time?
I`m running Windows XP.
[Image: cstrike2-02.png]
Reply
#15
Kill.bat only closes SRCDS, if you want to close watchdog.bat too, add this line inside Kill.bat (right click>edit)
Code:
kill -f watchdog.bat
Note: If you kill srcds.exe and watchdog.bat, srcds.exe will not be started again, this will just close the server
Reply


Forum Jump:


Users browsing this thread: 10 Guest(s)