I am using ubuntu 8.04.4 and would like to start daemons like this:

screen -dmS SESSIONNAME script.sh

Then i want to kill these screens with -X like so

screen -S SESSIONAME -X kill

But, this does not work. Only if i attach and detach that session it gets kill'ed with above command. What am i doing wrong? I would like to not have to attach/deattach the session to kill it since i want to use fabric scripts that start/stop daemons remotly.

- Thank you

link|improve this question
feedback

2 Answers

For daemons you really shouldn't be running them in screen.

In debian derived systems (such as Ubuntu) start-stop-daemon is the thing to use, RedHat and derivertives have a similar tool.

Read the man page, look at some init scripts for examples. on Ubuntu you may need to do a little delving as Upstart has mostly replaced standard init sctipts.

link|improve this answer
Yes you are right. These daemons are just for my development and the thing i want to use screen for is that i want to be able to start/stop them from my local system. thank you – Anonymous May 1 '10 at 20:00
feedback

Try this:

screen -S SESSIONAME -X quit
link|improve this answer
Great, -X quit did the trick. -- Thank you guys – Anonymous May 1 '10 at 19:58
feedback

Your Answer

 
or
required, but never shown