=== DingoSaar_ is now known as DingoSaar | ||
durka42 | can I get some help writing a service file? I'm trying to use a pre-stop script to have upstart gracefully kill my program by sending input to a screen session, like this http://unix.stackexchange.com/questions/13953/sending-text-input-to-a-detached-screen | 16:13 |
---|---|---|
durka42 | but it just... doesn't feel like running my pre-stop script, it seems | 16:13 |
durka42 | ah... it was just killing the process immediately after starting the pre-stop script, without waiting for it to run | 16:16 |
JanC | that doesn't sound right? | 16:23 |
durka42 | JanC: I dunno, but when I added "sleep 1" to the pre-stop script, it seems to work | 16:35 |
JanC | eh, if it didn't wait for the pre-stop script to finish that wouldn't help? | 16:37 |
durka42 | hmm, you're right | 16:37 |
durka42 | well, the first command in the pre-stop script uses screen -- maybe it forks and upstart doesn't notice? | 16:38 |
durka42 | take a look : https://github.com/haptics-nri/nri/blob/master/nri.conf | 16:38 |
JanC | screen is already running in the background, I assume, so you would have to wait for whatever you are doing in screen to end | 16:40 |
durka42 | that's correct, the pre-stop sends the quit command to the program running in screen | 16:41 |
durka42 | so that it doesn't get killed by SIGTERM | 16:41 |
durka42 | (because it's written in Rust which doesn't support signal handlers yet :( ) | 16:41 |
durka42 | is there a better way to wait for that exit than "sleep 1"? | 16:41 |
JanC | is there any (good) reason why you _need_ to run this inside screen? | 16:50 |
durka42 | JanC: I need to be able to connect to the console and interact with the program, if necessary | 16:55 |
durka42 | it has a CLI | 16:55 |
durka42 | it has a web server, too, so the CLI shoul never be necessary, but you know... bugs | 16:55 |
durka42 | anyway, I need to run | 16:59 |
durka42 | if you have an idea on how to make that service file cleaner, I might be around here later or you can file an issue at that github :) | 16:59 |
durka42 | thanks for your help! | 16:59 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!