GNU screen: "-X: unknown command 'hardcopy -h'
Posted: Wed Aug 04, 2010 2:08 pm
[PROBLEM]
I've finally discovered that GNU screen is not only good handling persistent sessions, but you can also remote-control a screen session by sending commands to it.
I wanted to take like a "screenshot" of a runnign session, by using the screen command "hardcopy" with a target filename, like this:
Unfortunately, I received the following error message in the target session:
[SOLUTION]
If you're sending a screen command with arguments, you must not use quotes. So the right commandline call is:
Voila!
TIPP!
Using hardcopy like this is perfect for monitoring background processes without giving someone shell-access, but rather dump the hardcopies to a path accessible over the network, so users can monitor things without being able to break anything.
I've finally discovered that GNU screen is not only good handling persistent sessions, but you can also remote-control a screen session by sending commands to it.
I wanted to take like a "screenshot" of a runnign session, by using the screen command "hardcopy" with a target filename, like this:
Code: Select all
screen -S "session_name" -X 'hardcopy "/tmp/test.log"'
However, without arguments, it worked fine:-X: unknown command 'hardcopy "/tmp/test.log"'
Code: Select all
screen -S "session_name" -X 'hardcopy'
If you're sending a screen command with arguments, you must not use quotes. So the right commandline call is:
Code: Select all
screen -S "session_name" -X hardcopy "/tmp/test.log"
TIPP!
Using hardcopy like this is perfect for monitoring background processes without giving someone shell-access, but rather dump the hardcopies to a path accessible over the network, so users can monitor things without being able to break anything.
