Question

I am an Ubuntu Linux user. I am running jobs remotely and started a screen session. During this session I sourced a file containing a long list of command lines arguments to be executed. I was forced off of the connection and now the jobs are still running in this screen and I am unable to kill them.

Does anyone know how to kill all running and future commands this script will execute. Thank you in advance.

Was it helpful?

Solution

Reattach the screen with

screen -D -r

then you can resume your session.

OTHER TIPS

If you just want to kill everything there is no need to even reattach to screen.

Just list the offending process(es):

pstree -pla

then kill whatever needs killing. Note that if you kill a process higher up the process tree, its children will (usually) go away as well.

Use ps to identify the pid of the shell process (bash, tcsh, etc), then kill that...

There are a couple of 'screen' ways to kill a specific screen session ...

1) send a 'quit' command:

screen -X -S "sessionname" quit

2) send a Ctrl-C to a screen session running a script:

screen -X -S "sessionname" stuff "^C"

In both cases, you would need to use 'screen -ls' to find the session name of the screen session you want to kill ... if there is only one screen session running, you won't need to specify the -S "sessionname" parameter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top