AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Source Servers (SRCDS) (https://forums.alliedmods.net/forumdisplay.php?f=130)
-   -   How to get -autoupdate on Windows (https://forums.alliedmods.net/showthread.php?t=173487)

Dr. McKay 12-05-2011 23:32

How to get -autoupdate on Windows
 
As most are aware, the -autoupdate command line parameter is not supported on the Windows version of SRCDS. However, using a simple batch file, the same functionality can be achieved! Combine this with Automatic Steam Update and your server will update itself!

The contents of the batch file are very simple:

Code:

@echo off
title SRCDS Watchdog/Updater
cls
echo (%date% %time%) Now starting SRCDS Watchdog/Updater
echo (%date% %time%) Now starting SRCDS Watchdog/Updater >> watchdog.log
:begin
echo (%date% %time%) Checking for SRCDS updates
echo (%date% %time%) Checking for SRCDS updates >> watchdog.log
start /wait C:\Path\To\hldsupdatetool.exe -command update -game tf -dir C:\Path\To\Server
echo (%date% %time%) Starting server
echo (%date% %time%) Starting server >> watchdog.log
start /wait C:\Path\To\Server\srcds.exe -game tf -console +maxplayers 32 +map ctf_2fort
echo (%date% %time%) WARNING: SRCDS quit or crashed, restarting
echo (%date% %time%) WARNING: SRCDS quit or crashed, restarting >> watchdog.log
goto begin

Paste this into Notepad and save it as watchdog.bat, as file type All Files. The batch file will even log all activity to watchdog.log. Edit the command lines for hldsupdatetool and srcds on the two lines that begin with start /wait. They're bold in the code above.

Just something that I've been using for a while and is quite useful. You might find it useful too.

Snaggle 12-06-2011 00:44

Re: How to get -autoupdate on Windows
 
I most defo will. Just switched to Windows Server 2008 on my dedicated and had no idea on how to go about autoupdating. Many thanks :)

checkster 12-06-2011 01:31

Re: How to get -autoupdate on Windows
 
Nice batch.

(of topic ) Tho steam should fix this, we should not rely on batch files.

Implying that I use win witch I do not, but still.

Dr. McKay 12-06-2011 08:37

Re: How to get -autoupdate on Windows
 
Quote:

Originally Posted by checkster (Post 1608476)
Nice batch.

(of topic ) Tho steam should fix this, we should not rely on batch files.

Implying that I use win witch I do not, but still.

Sorry, but it annoys me to no end when people mix up Steam and Valve. Steam can't fix anything, it's a software application. Valve is who you want to yell at to fix stuff.

I believe the fact that Windows doesn't have -autoupdate has something to do with the file system, in that Linux's file system support it, while Windows doesn't. Either way, the batch file also provides automatic crash recovery, so it's the best of both worlds. There's no harm in relying on a batch file.

Dr. McKay 12-06-2011 08:42

Re: How to get -autoupdate on Windows
 
Quote:

Originally Posted by Snaggle (Post 1608469)
I most defo will. Just switched to Windows Server 2008 on my dedicated and had no idea on how to go about autoupdating. Many thanks :)

I just set up a GMod server on Server 2008, and I had some permissions problems. Dunno if you've already done all this, but I got everything working properly by setting the permissions for the directory containing all my server files to Full Control for Everyone. You also need to change the owner of hldsupdatetool to Everyone, otherwise if there's an hldsupdatetool update, it can't overwrite it.

Just FYI.

gameguysz 12-06-2011 16:00

Re: How to get -autoupdate on Windows
 
Quote:

Originally Posted by Dr. McKay (Post 1608603)
I just set up a GMod server on Server 2008, and I had some permissions problems. Dunno if you've already done all this, but I got everything working properly by setting the permissions for the directory containing all my server files to Full Control for Everyone. You also need to change the owner of hldsupdatetool to Everyone, otherwise if there's an hldsupdatetool update, it can't overwrite it.

Just FYI.


Hey thats my server :P

yeah im using this batch system, just finished setting up sourcemod and everything and installed the auto update plugin which i also use on my TF2 server (Linux) But my gmod server is windows and batch works perfectly fine with no problems for me what so ever

Larsen 12-06-2011 16:53

Re: How to get -autoupdate on Windows
 
What should the encoding be?

Dr. McKay 12-06-2011 18:45

Re: How to get -autoupdate on Windows
 
Quote:

Originally Posted by Larsen (Post 1608816)
What should the encoding be?

Whatever the default is will be fine.

Larsen 12-07-2011 17:36

Re: How to get -autoupdate on Windows
 
I can't get this to work. This is what mine looks like:

Quote:

@echo off
title SRCDS Watchdog/Updater
cls
echo (%date% %time%) Now starting SRCDS Watchdog/Updater
echo (%date% %time%) Now starting SRCDS Watchdog/Updater >> watchdog.log
:begin
echo (%date% %time%) Checking for SRCDS updates
echo (%date% %time%) Checking for SRCDS updates >> watchdog.log
start /wait F:\srcds\hldsupdatetool.exe -command update -game dods -dir "F:\6th rb pub" -verify_all
echo (%date% %time%) Starting server
echo (%date% %time%) Starting server >> watchdog.log
start /wait "F:\6th rb pub\orangebox\srcds.exe" -game dod -console +maxplayers 32 +map dod_donner
echo (%date% %time%) WARNING: SRCDS quit or crashed, restarting
echo (%date% %time%) WARNING: SRCDS quit or crashed, restarting >> watchdog.log
goto begin
Bear in mind, this is on a secondary drive from the main C: drive, where the cmd.exe is.


**Edit: the first red line works. It updates and checks it just fine, takes like 15-25 seconds. The actually starting the server part does not work, it says "command failed, cannot find '-game'".

Dr. McKay 12-07-2011 20:46

Re: How to get -autoupdate on Windows
 
Quote:

Originally Posted by Larsen (Post 1609392)
I can't get this to work. This is what mine looks like:



Bear in mind, this is on a secondary drive from the main C: drive, where the cmd.exe is.


**Edit: the first red line works. It updates and checks it just fine, takes like 15-25 seconds. The actually starting the server part does not work, it says "command failed, cannot find '-game'".

Something funny with the start /wait command is, the file path can't have any spaces in it whatsoever, nor can it be enclosed in quotes. If you absolutely cannot rename your folder, you can use sysinternals junction.exe or 7's built-in symlink creator.


All times are GMT -4. The time now is 21:46.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.