H
H
hotcooler172011-06-11 20:16:40
linux
hotcooler17, 2011-06-11 20:16:40

Screen > file?

Please help me with this dilemma. On the server, a dialog process is running in screen. Sometimes (very rarely) you need to pass a command to the process, and you are too lazy to log in via ssh because of one command. Actually, passing the command to the process is simple, via screen -X. How can you get an answer?
All this should ideally be tied to perl/php, but I'll do it myself.
PS Googled for 2 days, but the word screen is not very searchable - in conjunction with the words output, file, php, perl, bash usually gives results about stdout.
PSS Again, the command needs to be passed to the process in screen . Not in the system.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kekekeks, 2011-06-11
@kekekeks

You don't need screen at all. Create a pipe (mkpipe) and transfer stdin and stdout there. Actually, it is possible to connect and read/write to them unrestrictedly.

P
Pavel, 2011-06-11
@OmIkRoNiXz

As an option in PHP, for example, you can give a command to the process in the screen like this:
$cmd = sprintf("screen -S $screen_name -p 0 -X stuff \"rcon_password%s\"", chr(10));
and there already, for example,
exec("ssh server1 ".$cmd);
and you can read the result, for example, by telling the screen to do hardcopy and read what the output was
screen -S $screen_name -p 0 -X hardcopy ./hardcopy
and the “hardcopy” file will then contain the result
something like this :)

W
whynot, 2011-06-11
@whynot

Oh, I'm not the only one writing game hosting for Steam games :))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question