Posts Tagged ‘screen’

Sending commands to detached screens

November 5th, 2007 No comments

For running Azureus headless on my linux machine I use screen so it runs in a separate screen.

The command to do this is the following:

screen -d -m -S azureus su -p azureus -c "/opt/azureus/"

This will create a detached screen with the name “azureus” which will run the command “su -p azureus -c “/opt/azureus/”

To send a command to this detached screen we can use the following command structure: (Which I use to tidily close the process)

screen -S azureus -p 0 -X eval 'stuff quit\015'

-p 0 tells screen to use window 0 on the specified screen. Using the eval function makes sure the \015 char will be evaluated back into an enter character. The stuff command is used to fill the input buffer of the screen program.

After this the command “quit” is sent to the azureus client which will cause it to quit and close the attached screen.

Categories: General Tags: , , ,