Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

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.

share|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
add comment

Try this:

screen -S SESSIONAME -X quit
share|improve this answer
    
Great, -X quit did the trick. -- Thank you guys –  Anonymous May 1 '10 at 19:58
    
It works for me, thanks! –  Oleg Jun 5 '12 at 11:54
add comment

Your Answer

 
discard

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