How do I kill a screen if I know the name of it?

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!

1

2 Answers

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.

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)

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like