A way to send Fast commands from command line?

Discover FAST, a records keeping server control script with a public records system called Dedimania, which will show records from the server on tm-exchange.com

Moderators: Slig, TM-Patrol

Post Reply
Mort
smooth traffic navigator
smooth traffic navigator
Posts: 275
Joined: 16 Jan 2009 10:57
Owned TM-games: TMUF, TMNF
Location: Australia
Contact:

A way to send Fast commands from command line?

Post by Mort » 14 Oct 2011 05:00

Maybe a question for Slig,

I want to write some scheduled tasks to run on my windows server. One of them will be to update the matchsettings files with new tracks. Once it does that I need a way to trigger a "/maps matchsettings\server.txt" to the server from a windows command line.

Is there a "native" way I can send automated commands to the server, or to FAST, from a command line without needing to go into the server? Perhaps using a php script? (I can read php, but I'm not good enough to write new code from scratch)

There may be a command-line XMLRPC program out there already, but all I've found are GUI based ones for manual remote management. Being able to return results for things like "/custom GetServerPlanets" would be cool as well.

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: A way to send Fast commands from command line?

Post by Xymph » 14 Oct 2011 05:47

Mort wrote:There may be a command-line XMLRPC program out there already, but all I've found are GUI based ones for manual remote management. Being able to return results for things like "/custom GetServerPlanets" would be cool as well.
The RPC Utilities include a command-line based sendcmd.php script: http://www.xaseco.org/tools.php
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Mort
smooth traffic navigator
smooth traffic navigator
Posts: 275
Joined: 16 Jan 2009 10:57
Owned TM-games: TMUF, TMNF
Location: Australia
Contact:

Re: A way to send Fast commands from command line?

Post by Mort » 14 Oct 2011 06:20

Ah, that's excellent! Thanks Xymph.

User avatar
Slig
Pit Crew
Pit Crew
Posts: 2124
Joined: 05 Sep 2005 17:51
Owned TM-games: ALL
Location: TraxicoLand (Fr)
Contact:

Re: A way to send Fast commands from command line?

Post by Slig » 14 Oct 2011 09:41

Yes, using it you can just for example do something like :

Code: Select all

php sendcmd.php LoadMatchSettings matchsettings/server.txt
and if you want, also :

Code: Select all

php sendcmd.php NextChallenge
(of course the right xmlrpc port and superadmin pass have to be configured in the config file)


Btw, i thought about it for long time : i will probably add an Echo subcommand to allow to send a chat command from external scripts (mainly for sendcmd.php), and perhaps also an Echo subcommand usable to send dedicated methods indirectly (ie Fast would send it, with advantage that it would know about it), and why not also an Echo subcommand usable to tell to Fast to retrieve servers options, game infos, etc. because an external script have changed config (mainly for sencmd.php, and also eventually for managers which would add support for it).

Mort
smooth traffic navigator
smooth traffic navigator
Posts: 275
Joined: 16 Jan 2009 10:57
Owned TM-games: TMUF, TMNF
Location: Australia
Contact:

Re: A way to send Fast commands from command line?

Post by Mort » 14 Oct 2011 09:44

Yup, got it sorted already. Would be handy if sendcmd.php could take the xmlrpc port as a command line option as well, but I've just made multiple copies and edited each one to suit each of my servers instead.

Xymph
Pit Crew
Pit Crew
Posts: 5650
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: A way to send Fast commands from command line?

Post by Xymph » 14 Oct 2011 17:35

Slig wrote:

Code: Select all

php sendcmd.php NextChallenge
On Linux, you can just use ./sendcmd.php or <pathto>/sendcmd.php, as the script is executable and uses the #! convention.
Mort wrote:Would be handy if sendcmd.php could take the xmlrpc port as a command line option as well, but I've just made multiple copies and edited each one to suit each of my servers instead.
IMO it would be very annoying to have to type that everytime. You could use wrapper scripts per server/port to avoid that, but then you're right where you are now. :) Btw, I do it the same way for my servers.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Post Reply