SpamapS | zhilbert: you need 2 jobs to do that | 00:16 |
---|---|---|
SpamapS | zhilbert: one to iterate over the files in the dir, the other to be the actually running instances | 00:17 |
zhilbert | Thanks SpamapS. I've got that part working. I think my issues are with daemon not with upstart. | 02:30 |
=== tormod is now known as tormod_ | ||
=== tormod_ is now known as tormod | ||
shaz_ | hey, so I have a python daemon based on: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ | 16:31 |
shaz_ | and the following upstart script | 16:32 |
shaz_ | http://pastebin.com/qvkJqAuC | 16:32 |
shaz_ | but it is hanging when i start/stop | 16:33 |
shaz_ | i've tried with combinations of expect /fork/daemon but nothing seems to work | 16:33 |
shaz_ | any ideas? | 16:33 |
shaz_ | i have checked the command works normally in the terminal | 16:35 |
shaz_ | so I am thinking its something to do with my upstart config | 16:35 |
SpamapS | shaz_: that upstart config should return as soon as python is executed | 16:38 |
SpamapS | shaz_: rather, 'starting' that upstart job | 16:38 |
SpamapS | shaz_: however, the daemonize code you posted wants 'expect daemon' | 16:39 |
SpamapS | shaz_: can you be more clear when you say "it is hanging" ? | 16:40 |
shaz_ | I mean it doesn't ever return | 16:40 |
shaz_ | as if you were running the blocking script in the terminal | 16:41 |
shaz_ | i've just tried it with expect daemon | 16:41 |
shaz_ | and it still does the same | 16:41 |
shaz_ | I am doing all of this over ssh, if that makes a difference | 16:42 |
SpamapS | shaz_: it does not make a difference no | 16:42 |
SpamapS | shaz_: can you pastebin the output of 'strace -e trace=process -f /home/ubuntu/LoudPopcorn/venv/bin/python /home/ubuntu/LoudPopcorn/TwitterClient/streaming.py' ? | 16:44 |
shaz_ | sure, give me a sec | 16:45 |
shaz_ | http://pastebin.com/3NbCfpdF | 16:46 |
SpamapS | shaz_: for the record, the upstart job you pasted makes it nearly impossible for 'start ...' to block.. because upstart will consider the job started immediately upon executing python | 16:46 |
SpamapS | shaz_: any chance you have a 'start on starting that-jobs-name' in some other job that blocks? | 16:46 |
shaz_ | no i don't have that in any other scripts | 16:47 |
SpamapS | shaz_: interesting. I think virtualenv may make using 'expect ...' impossible because of all the stuff it has to fork and exec first | 16:49 |
SpamapS | shaz_: in this case, I'd suggest having a --nodaemonize mode for your code, and just let upstart manage it in the foreground | 16:49 |
SpamapS | shaz_: also its worth noting that you need a 'setgid ubuntu' also.. | 16:50 |
shaz_ | ok, i will give that a go. | 16:50 |
shaz_ | ok | 16:50 |
SpamapS | shaz_: also its worth nothing that if this is a cloud instance, you should *NOT* run code as ubuntu (it has sudo w/o password) | 16:50 |
shaz_ | um, same thing when i run without daemon | 16:56 |
shaz_ | (without expect daemon) | 16:56 |
SpamapS | shaz_: try 'sudo initctl log-priority info' ... note the last line in syslog, and then run the 'start' and then pastebin the lines produced by 'init:' in syslog | 17:55 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!