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 have a screen named 'foo' that I started using the command

screen -S foo -d -m  my_command_goes_here.

I want to put this in cron, and restart it nightly by killing the screen. The reason I'm using a screen is my command starts up several other procs and this will ensure they all exit.

So... what is the command to kill sceen 'foo'?

Thanks!

share|improve this question
1  
What commands are you running that you require screen to have them properly exit? –  Darren Hall Feb 22 '10 at 19:47

2 Answers 2

screen -S foo -X quit

From the man page:

-X  Send the specified command to a running screen session.
...
quit    Kill all windows and terminate screen.
share|improve this answer

Try using this:

screen -S foo -X kill

I would be cautious tho, depending on what you're running and the state that it's in, this may not kill the processes running in screen, and maybe cause file system instability if it has any files open (i don't know for sure, i'm just assuming)

share|improve this answer
    
unfortunately this didn't work. –  Poul Feb 22 '10 at 19:01
    
worked for me, was on ubuntu. But I only had one window open in screen. Should have done more testing. –  Roy Rico Feb 22 '10 at 19:47
2  
only reason why I can't see this working is if you have more than 1 screen session named foo, use screen -list to get a list of current running sessions. –  Darren Hall Feb 22 '10 at 19:58

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.