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