[03:49] <fluter> hi, I use expect daemon, but then I add exec mydaeomin in script block, it cannot track the right pid,
[03:50] <fluter> anyone suggests?
[04:56] <fluter> hello people
[06:50] <fluter> hello people
[08:17] <fluter> hello people
[10:23] <xnox> fluter: "exec" cancels any expect, and tracks that pid.
[10:24] <xnox> don't use exec, if you want to use expect daemon
[10:24] <xnox> (inside script block that is)
[10:25] <fluter> xnox, what is exec will track if no script block?
[10:26] <xnox> fluter: exec outside script block is an upstart stanza, and will use expect correctly.
[10:26] <xnox> fluter: exec inside script block is exec(1posix) which doesn't consider "expect" upstart stanzas.
[10:27] <xnox> http://manpages.ubuntu.com/manpages/trusty/en/man1/exec.1posix.html
[10:27] <xnox> vs
[10:27] <fluter> xnox, because I have some setups before exec, so have to use script block
[10:27] <xnox> can you pastebin your full job.
[10:27] <xnox> ?
[10:27] <fluter> xnox, sure, 
[10:31] <fluter> xnox, http://sprunge.us/DMhP
[10:32] <fluter> I use this, and the pid is wrong
[10:32] <xnox> fluter: just remove "exec" word, and all should just work.
[10:32] <xnox> fluter: why did you add exec, instead of just:
[10:32] <xnox> script
[10:32] <xnox> [ -f /etc/sysconfig/chunk_server_main ] && . /etc/sysconfig/chunk_server_main
[10:32] <xnox> /usr/sbin/chunk_server_main  $CHUNK_SERVER_MAIN_OPTIONS
[10:32] <xnox> end script
[10:33] <fluter> xnox, I read the docs, it says exec is to run the command :) I read it wrong :(
[10:33] <fluter> section for exec in upstart cookbook
[10:33] <fluter> thanks a lot xnox 
[10:34] <xnox> fluter: on it's own, not inside a script block, which is fed completely into "sh -c"
[10:34] <fluter> xnox, another question, inside script, there are mutiple lines, which pid will upstart tracking?
[10:34] <xnox> the first one.
[10:35] <xnox> so e.g. sourcing /etc/sysconfig/chunk_server_main may not exec processes.
[10:35] <fluter> xnox, that would be the [  ] one?
[10:35] <fluter> xnox, /usr/sbin/chunk_server will fork twice  to become a daemon, witll that work?
[10:36] <xnox> it should work.
[10:37] <xnox> [ ] is not a process, but a shell builtin. Checked with strace against dash.
[10:37] <fluter> xnox, I see
[10:39] <fluter> xnox, I removed exec, but it still says the wrong pid
[10:39] <fluter> xnox, initctl status says 1521, but ps shows it is 1523
[10:40] <fluter> I think it got the pid before fork
[10:40] <xnox> fluter: what's the pid you want to track, and what does "status job" say?
[10:40] <fluter> xnox, status says "chunkd sttart/running, process 1521"
[10:40] <fluter> but in ps, it is 1523
[10:40] <xnox> fluter: did you follow http://upstart.ubuntu.com/cookbook/#how-to-establish-fork-count ?
[10:40] <fluter> because it's the wrong pid, stop job will hang
[10:41] <fluter> xnox, yes, the daemon fork twice, so I used expect daemon
[10:41] <xnox> fluter: did you fully stop the job after modifying the config files?
[10:42] <fluter> xnox, yes
[10:42] <xnox> (as in initctl said stop/waiting)
[10:42] <xnox> ok.
[10:42] <fluter> xnox, I rebooted
[10:42] <xnox> fluter: can you provide the strace.log ? is in http://upstart.ubuntu.com/cookbook/#how-to-establish-fork-count ?
[10:42] <fluter> ok, 1 sec
[10:43] <xnox> also try a basick job first http://paste.ubuntu.com/7622871/
[10:47] <fluter> xnox, http://sprunge.us/LaUG
[10:49] <fluter> xnox, it works, 
[10:50] <fluter> the paste you gave, it tackes right pid, so I can start stop without hang
[10:50] <xnox> fluter: what's the contents of  /etc/sysconfig/chunk_server_main ?
[10:50] <fluter> some lines of NAME=VALUE paris
[10:50] <fluter> pairs
[10:51] <xnox> does it have any $(), `cmd` or commands that are executed ?
[10:51] <fluter> xnox, no, it is all static shell variables
[10:54] <fluter> hmm, if use script block, if only one line of /usr/sbin/..., it works,
[10:54] <fluter> if I add . /etc/sysconfig/some config file, it does not work anymore
[10:55] <fluter> I think source a shell file is the problem
[10:56] <xnox> one option is to have two jobs
[10:56] <xnox> in one job do:
[10:56] <xnox> task
[10:56] <xnox> script
[10:57] <xnox> . /etc/sysconfig/chunk_server_main
[10:57] <xnox> start chunk-server VAR1=$VAR1
[10:57] <xnox> end script
[10:58] <fluter> in the chunk-server job, it will get the VAR1 variable?
[10:58] <xnox> yes.
[10:58] <fluter> aha, ok
[10:58] <fluter> let me try that
[10:58] <xnox> so one job is a "sourcer/environment assembler", the other one just runs the daemon straight.
[10:59] <fluter> xnox, start command will start it, but will it be started twice,
[10:59] <fluter> when init says chunk-server in /etc/init