Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wish to rejoin an existing screen (there is only one on my system) kill window 6:

screen -r -p 6 -X kill 

and execute the following command in a new window:

cd /opt/stack/neutron && python /usr/local/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file=/etc/neutron/dhcp_agent.ini

All I know is screen -r -X screen will start a new window (numbered 6) but how do I execute the above command in that window?

share|improve this question

1 Answer 1

Try to screen sub command.

screen -r -x -X screen 6 bash -c 'cd /opt/stack/neutron && python /usr/local/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file=/etc/neutron/dhcp_agent.ini'

NOTE: This window(window number 6) is automatically closed if last command (this case is python invoked from bash) ends.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.