/srv/irclogs.ubuntu.com/2015/07/11/#upstart.txt

=== DingoSaar_ is now known as DingoSaar
durka42can 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-screen16:13
durka42but it just... doesn't feel like running my pre-stop script, it seems16:13
durka42ah... it was just killing the process immediately after starting the pre-stop script, without waiting for it to run16:16
JanCthat doesn't sound right?16:23
durka42JanC: I dunno, but when I added "sleep 1" to the pre-stop script, it seems to work16:35
JanCeh, if it didn't wait for the pre-stop script to finish that wouldn't help?16:37
durka42hmm, you're right16:37
durka42well, the first command in the pre-stop script uses screen -- maybe it forks and upstart doesn't notice?16:38
durka42take a look : https://github.com/haptics-nri/nri/blob/master/nri.conf16:38
JanCscreen is already running in the background, I assume, so you would have to wait for whatever you are doing in screen to end16:40
durka42that's correct, the pre-stop sends the quit command to the program running in screen16:41
durka42so that it doesn't get killed by SIGTERM16:41
durka42(because it's written in Rust which doesn't support signal handlers yet :( )16:41
durka42is there a better way to wait for that exit than "sleep 1"?16:41
JanCis there any (good) reason why you _need_ to run this inside screen?16:50
durka42JanC: I need to be able to connect to the console and interact with the program, if necessary16:55
durka42it has a CLI16:55
durka42it has a web server, too, so the CLI shoul never be necessary, but you know... bugs16:55
durka42anyway, I need to run16:59
durka42if 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
durka42thanks for your help!16:59

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!