SRCDS Steam group


[Help: Batch File] How to close the batch file and it will close srcds.exe?
#1
Hello.

I need someone who can help me with a batch script.
What I need is a batch file there will automatic close the srcds.exe if the batch script close.

I currently have this:
Code:
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -console -game cstrike +map de_dust2 +maxplayers 12
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds
- This will only keep the server up and running, if the srcds.exe crash, witch I also need.

But in my webpanel I have made a stop button to stop the server from running.
My button stop the batch script, so the batch script then needs to force the srcds.exe to shutdown with it.

Do anyone know how this can be made?
- Thanks Smile.
Reply
#2
You would need a rcon CLI program to pass the command "shutdown" to the server.
Trust me when I say it's not worth it.
~ Mooga ...w00t? - SRCDS.com on Twitter
[Image: 76561197965445574.png]
Please do not PM me for server related help
fqdn Wrote:if you've seen the any of the matrix movies, a game server is not all that different. it runs a version of the game that handles the entire world for each client connected. that's the 2 sentence explanation.
Reply
#3
You can use this: http://forums.srcds.com/viewtopic/15072
It will convert you game server to a service, then you can start/stop that one.

If you choose to use it, give me a hint, cause then I will update the version that is uploaded here.
Reply
#4
(02-22-2011, 05:51 PM)Nisd Wrote:  You can use this: http://forums.srcds.com/viewtopic/15072
It will convert you game server to a service, then you can start/stop that one.

If you choose to use it, give me a hint, cause then I will update the version that is uploaded here.

Hello, thanks for helping me out .
But I can't figure out how this works, but what I have tried is this:

I unzipped ApplicationToService.exe and ApplicationToService.exe.config to this folder "C:\dedi1\SRCDS\orangebox\"

My ApplicationToService.exe.config look like this:
Code:
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <!-- The name of the Service, do not change this unless you already uninstalled the service -->
    <add key="ServiceName" value="ApplicationToService"/>
    <!-- The application you wish to run -->
    <add key="ApplicationToRun" value="srcds.exe"/>
    <!-- Commandline / Parameters -->
    <add key="ApplicationParameters" value="install"/>
    <!-- Working Direcotry -->
    <add key="ApplicationWorkingDirectory" value="C:\dedi1\SRCDS\orangebox"/>
    <!-- If  you application should restart when it exit -->
    <add key="RestartApplicationOnExit" value="True"/>
    <!-- If the application should restart if it is not responding -->
    <add key="CheckApplicationResponding" value="True"/>
    <!-- Check if a TCP socket can connect, leave empty for disable -->
    <add key="CheckTCPConnectivity" value=""/>
    <!-- How often to Check -->
    <add key="CheckInterval" value="5000"/>
  </appSettings>
</configuration>

And then i click on the ApplicationToService.exe,
It runs for 1 sec and close again.
Then I go into my Services but the name "ApplicationToService" doesn't come up?

Do you know what i have done wrong ?
Reply
#5
You need to run it with cmd, and run it as
Code:
ApplicationToService install
Reply
#6
(02-23-2011, 04:18 AM)Nisd Wrote:  You need to run it with cmd, and run it as
Code:
ApplicationToService install

Okay, thanks again.
I really appreciate that you are trying to help me out Smile.

So far my config is:
Code:
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <!-- The name of the Service, do not change this unless you already uninstalled the service -->
    <add key="ServiceName" value="ApplicationToService"/>
    <!-- The application you wish to run -->
    <add key="ApplicationToRun" value="srcds.exe"/>
    <!-- Commandline / Parameters -->
    <add key="ApplicationParameters" value="-console -game cstrike -tickrate 66 -maxplayers 12 +map de_dust2"/>
    <!-- Working Direcotry -->
    <add key="ApplicationWorkingDirectory" value="C:\dedi1\SRCDS\orangebox"/>
    <!-- If  you application should restart when it exit -->
    <add key="RestartApplicationOnExit" value="True"/>
    <!-- If the application should restart if it is not responding -->
    <add key="CheckApplicationResponding" value="True"/>
    <!-- Check if a TCP socket can connect, leave empty for disable -->
    <add key="CheckTCPConnectivity" value=""/>
    <!-- How often to Check -->
    <add key="CheckInterval" value="5000"/>
  </appSettings>
</configuration>

Then I went into C:\Windows\System32 and opened cmd.exe and typed: ApplicationToService install
But it can't find it.

I also tried to replace
Code:
<add key="ApplicationParameters" value="-console -game cstrike -tickrate 66 -maxplayers 12 +map de_dust2"/>
with
Code:
<add key="ApplicationParameters" value="ApplicationToService install"/>

But that didn't help. So for the movement I have no clue.
I'm not good at this but I hope you have an idea of what i'm doing wrong. And hopefully you still want to share it Smile.

- Thanks
Reply
#7
Your first config file was correct Smile So just keep that one.

Okay first do.
Press Win + R
then write "cmd" and press enter.
write "cd /d [directory the application is in]"
then write "applicationtoservice install"

// Note to self, make it easier to install Smile
Reply
#8
Thank you for the help Wink!
Its working Smile. The SRCDS.exe is now a service ;p.
Reply
#9
np Smile (Well not really was a problem)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)