Raised This Month: $51 Target: $400
 12% 

How to get -autoupdate on Windows


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-05-2011 , 23:32   How to get -autoupdate on Windows
Reply With Quote #1

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.
__________________

Last edited by Dr. McKay; 12-06-2011 at 08:39.
Dr. McKay is offline
Snaggle
AlliedModders Donor
Join Date: Jul 2010
Location: England
Old 12-06-2011 , 00:44   Re: How to get -autoupdate on Windows
Reply With Quote #2

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

Last edited by Snaggle; 12-06-2011 at 00:44.
Snaggle is offline
checkster
BANNED
Join Date: Apr 2007
Location: Norway
Old 12-06-2011 , 01:31   Re: How to get -autoupdate on Windows
Reply With Quote #3

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.

Last edited by checkster; 12-06-2011 at 01:34. Reason: Implying that I use win witch I do not, but still.
checkster is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-06-2011 , 08:37   Re: How to get -autoupdate on Windows
Reply With Quote #4

Quote:
Originally Posted by checkster View Post
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 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-06-2011 , 08:42   Re: How to get -autoupdate on Windows
Reply With Quote #5

Quote:
Originally Posted by Snaggle View Post
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.
__________________

Last edited by Dr. McKay; 12-06-2011 at 08:42.
Dr. McKay is offline
gameguysz
Member
Join Date: Aug 2011
Location: USA
Old 12-06-2011 , 16:00   Re: How to get -autoupdate on Windows
Reply With Quote #6

Quote:
Originally Posted by Dr. McKay View Post
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

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
gameguysz is offline
Larsen
Senior Member
Join Date: Oct 2011
Old 12-06-2011 , 16:53   Re: How to get -autoupdate on Windows
Reply With Quote #7

What should the encoding be?
__________________

Larsen is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-06-2011 , 18:45   Re: How to get -autoupdate on Windows
Reply With Quote #8

Quote:
Originally Posted by Larsen View Post
What should the encoding be?
Whatever the default is will be fine.
__________________
Dr. McKay is offline
Larsen
Senior Member
Join Date: Oct 2011
Old 12-07-2011 , 17:36   Re: How to get -autoupdate on Windows
Reply With Quote #9

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'".
__________________


Last edited by Larsen; 12-07-2011 at 18:48.
Larsen is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-07-2011 , 20:46   Re: How to get -autoupdate on Windows
Reply With Quote #10

Quote:
Originally Posted by Larsen View Post
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.
__________________
Dr. McKay is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:30.


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