Help - Search - Members - Calendar
Full Version: Send Text To A Detached Screen Session
Linuxhelp > Support > Technical Support
Xayd
Thanks in advance for what's probably a simple yes/no answer wink.gif.

The situation is...

I have a Debian box, runs a game server.

Said game server stays active in the terminal session that launches it.

There's no easy and bug free remote management utility for said game server, so my idea is to set up some custom commands in usermin to let other users of the server change the map, change the mod the game runs, etc.

So, running these commands from usermin, it's necessary to start the server in a detached screen session, since the server needs a terminal session to run in and since it's started from a webpage it has no terminal session otherwise and goes defunct. This works to start the server just fine, and it can be stopped by doing a killall on the screen process, so that's also fine.

The next step, though, is being able to send commands to the game terminal with usermin/webmin custom commands.

Is it possible to send text and/or commands to a detached screen session without re-attaching it? The screen man page seems to hint that this is possible with the -X switch, but the documentation is a bit sketchy on that option, I'm not sure whether it'll take any text or system command or only screen commands, and all tinkering i've done with the -X switch has failed.

Can this be done or not?
garskoci
Which game are you running? I run a SOF2 server. To send commands, I send messages to the TCP/IP port. This is done through a small Perl script that I started and continually improve. What type of commands are you trying to use?
Corey
I run a Quake3 Urban Terror server, so I wrote an eggdrop module that accepts rcon (remote console) commands on irc (password protected of course) and executes them on the game server.

It would help more if we knew what said game was.
Xayd
The game is battlefield 1942, it's not system commands that need to be sent to it, just some stuff specific to the server (for instance admin.kickplayer, admin.changemap (mapname), etc.).
garskoci
Are the commands rcon commands?
Xayd
Yeah, they would be, and remote console on the server is enabled on a specific port.

After further testing it seems that the screen -X switch does in fact only accept commands recognized by screen, so an external method of sending commands is gonna have to be the answer it seems.
Corey
Well, i'll be happy to share with you what I did to use remote console commands through an IRC bot, i'm sure without too much effort, you should be able to port that to php or something.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.