[22:19] <zaufi> hi all. anyone alive&
[22:19] <zaufi> ??
[22:23] <mbiebl> only zombies around here
[22:23] <zaufi> :)
[22:24] <zaufi> I've got a problem w/ writing upstart script for my daemon... :( anyone can help?
[22:28] <mbiebl> not without a crystal ball
[22:28] <mbiebl> unless you tell what the problem is
[22:29] <zaufi> `service stop mydaemon` won't send a SIGTERM to my daemon... it hust hangs on poll() some socket (dbus I guess)...
[22:29] <zaufi> s,hust,just,
[22:30] <zaufi> I use 'expect daemon' in the script (which is means that daemon will fork() tiwce, as my daemon do)
[22:30] <mbiebl> you mean "stop foo", not "service stop foo"?
[22:31] <zaufi> yep
[22:31] <zaufi> ... I'm playing with ubuntu 10.10 where `service` calls `start`/`stop` for upstarted programs
[22:32] <mbiebl> can you run your daemon without forking?
[22:32] <ion> Don’t use the expect stanza unless you’re *absolute* sure of the forking behavior of your main process. The current version of Upstart gets confused if the behavior differs from what the expect stanza claims.
[22:32] <ion> absolutely
[22:32] <zaufi> I'm prettu sure my daemon fork() exactly twice :)
[22:33] <ion> Please pastebin the job definition.
[22:33] <mbiebl> does status foo list the correct pid?
[22:34] <ion> The next major release of Upstart will have a considerably better method of following forks.
[22:34] <zaufi> mbiebl: oops... I'm forget to check... let me reboot to ubuntu and check :) (I'm in gentoo usually)
[22:34] <zaufi> I'm just trying to get familiar w/ ubuntu )
[22:39] <zaufi> mbiebl: PIDs are differ...
[22:40] <mbiebl> that's your problem then
[22:40] <ion> Please pastebin the job definition.
[22:40] <zaufi> mbiebl: http://pastebin.com/HRfuCdWr
[22:40] <mbiebl> as said, can you run your daemon without forking?
[22:41] <zaufi> http://pastebin.com/VHW8UzcV
[22:41] <zaufi> Ok I'll try... but how to 'stop` it now :((
[22:42] <mbiebl> kill 2060
[22:43] <zaufi> so I have to comment 'expect' stanza and remove -d option (to allow fg execution) ... am I correct??
[22:43] <mbiebl> yeah, try that
[22:44] <zaufi> huh... `start` hangs
[22:44] <zaufi> cut it poll() smth
[22:44] <zaufi> s,cut,cuz.
[22:45] <zaufi> if I Ctrl-C it next start it says that indexer already running
[22:45] <zaufi> I guess I have to reboot... to cleanup dbus state
[22:45] <zaufi> ??
[22:50] <zaufi> mbiebl: w/o '-d' and expect start/stop works fine
[22:53] <mbiebl> problem solved
[22:54] <zaufi> not exactly... (
[22:54] <zaufi> my program must be running w/ -d
[22:54] <zaufi> in fg mode it makes spam to console only... in -d (daemon) to syslog
[22:55] <zaufi> so being running w/o -d from upstart I can't c any log messages
[22:57] <mbiebl> zaufi: you can try export fork
[22:57] <mbiebl> instead of daemon
[22:58] <mbiebl> argh, expect fork
[22:58] <zaufi> it fork() twice!
[22:58] <zaufi> as most real daemons do
[22:58] <ion> Or strace -f it to see exactly what it *really* does. :-)
[23:00] <zaufi> `expect fork` won't stop it, as expected
[23:04] <zaufi> http://pastebin.com/ZgHubxM8
[23:05] <zaufi> here is a strace result... I used 'expect daemon'
[23:06] <zaufi> and it still pilling...
[23:06] <ion> I mean strace -o strace.out -f /…/indexer -d
[23:07] <zaufi> ok
[23:07] <zaufi> just a sec
[23:13] <zaufi> this is first child: http://pastebin.com/Vs3EKTbz
[23:13] <zaufi> this is second generation child: http://pastebin.com/cKSusw2W
[23:14] <zaufi> I used -ff for strace cuz daemon loads JVM (which makes a lot of spam)
[23:14] <ion> Use -f
[23:15] <zaufi> ok
[23:16] <zaufi> 270K ... same file sharing required
[23:16] <zaufi> just a sec I'll find smth
[23:18] <ion> Perhaps just egrep -A5 -B5 'clone|exec|exit' or something like that.
[23:18] <zaufi> http://up.k10x.net/webgkjidzbojj/indexer.log
[23:21] <ion> Java seems to do ten forks or so before your code daemonizes.
[23:21] <ion> Upstart happily follows the first one of them and gets confused.
[23:21] <zaufi> it forks threads
[23:21] <zaufi> not processes
[23:22] <zaufi> I think I can delay JVM loading... and do it after daemonize...
[23:22] <zaufi> I need some tome to fix a code
[23:23] <ion> You could separate the parameter to daemonize from the parameter to log to syslog.
[23:39] <Voting> I want to start my application level server (a tomcat instance) once everything else is running... how do I run something at the end of the existing startup sequence ?
[23:58] <Voting> I want to start my application-level server (a tomcat instance) once everything else is running... how do I run something at the end of the existing startup sequence ?