/srv/irclogs.ubuntu.com/2011/03/16/#upstart.txt

twbI wrote an upstart job for nsd3, and it works.09:44
twb...except when nsd3 needs to regenerate its database, in which case it seems to fork even when I tell it not to09:44
twbI don't really want to "expect fork"; it's such a hack09:47
twbhttp://paste.debian.net/110841/09:49
twbWhat am I supposed to do about that?09:49
twbOK, now I understand10:14
twbApparently when you -HUP (reload) nsd, it gets a whole new PID, and it writes the PID to its designated pidfile, but upstart doesn't know this.10:14
twbSo I think I just have to give up and define "pre start exec nsdc start" and "pre stop exec nsdc stop" instead of "exec nsd -d"10:15
twbFixed: http://paste.debian.net/110845/10:23
JanCI guess for such situations it would be useful to be able to point upstart to a "pidfile"...11:34
sorenJanC: I think for such situations, it would be useful to stab someone in the face for fork()ing on SIGHUP.12:03
sorenJanC: That's just madness.12:03
SpamapSsoren: sshd and squid use this "madness"12:48
SpamapSsoren: not sure we should ignore their success as highly stable daemons ;)12:48
sorenSpamapS: I don't believe that's true.13:04
SpamapSsoren: look at the recent bug fixes to the upstart confs for squid and sshd13:05
SpamapSboth to move them to running in the foreground because they fork on HUP13:05
sorenSpamapS: I'm looking at sshd.c right now. sighup_restart execve's. I does not fork().13:05
ionjanc: Insanity lies on that path.13:05
SpamapSexecve's.. which subsequently, forks13:05
sorenSpamapS: Oh.13:05
SpamapSyeah.. its t3h suck13:05
SpamapSbreaks the assumptions that expect fork makes unfortunately13:06
* soren facepalms13:06
SpamapSWhich, btw, are not well documented. :-P13:06
SpamapSThe postfix developers have expressed interest in supporting upstart, but have also stated they won't do so until the interface for expect fork/reload/etc. is published13:07
dscI have an upstart job.  I'd like to stop it gracefully.  Is there someway to specify a script to stop it?15:03
ralfgrois there someting like "X-Start-Before:" from insserv in upstart?15:08
dscI have an upstart job.  I'd like to stop it gracefully.  Is there someway to specify a script to stop it?15:22
dscdamn. I swear I looked for where I'd posted that question and couldn't find it (until I pressed ENTER).15:22
SpamapSralfgro: start on starting16:25
SpamapSdsc: what do you mean gracefully?16:25
SpamapSdsc: stop job_name tells upstart to send SIGTERM, then after kill timeout (default 5 seconds) SIGKILL16:26
dscSpamapS: by graceful, what I mean is I want to run a script to stop it because I don't have any reason to suspect SIGTERM will be handled gracefully.16:37
Keybukpre-stop script16:38
Keybuk  ...16:38
Keybukend script16:38
Keybuk;-)16:38
dscKeybuk: great.  Thanks.16:38
Keybukone of the main uses for a pre-stop is to perform a graceful shut down16:38
dscI didn't see pre-stop documented anywhere, only post-stop16:39
Keybukdsc: it's documented in "man 5 init"16:39
Keybuk       pre-stop exec|script...16:39
Keybuk              This process is run if the job is stopped by an event listed  in16:39
Keybuk              its  stop  on  stanza or by the stop(8) command.  It will be run16:39
Keybuk              before the job's stopping(7) event is  emitted  and  before  the16:39
Keybuk              main process is killed.  It is typically used to send any neces‐16:39
Keybuk              sary shutdown commands to the main process, and it may also call16:39
Keybuk              the start(8) command without arguments to cancel the stop.16:39
SpamapSKeybuk: if ever there was a time to create an upstart shirt.. now that 1.0 is out.. I think it should just read 'man 5 init' on the front.16:40
Keybuk"Upstart isn't documented! ... Except for all the man pages"16:44
dscnone of the top google hits mention it.  I'm probably on an older version, which might explain my man pages.16:44
Keybukdsc: you would have to be on a very, very old version16:45
dscI guess I didn't fin it because I was doing "man init" and getting "man 8 init"16:45
Keybukwhich has, on the very first screenful16:46
Keybuk       Processes managed by init are known as jobs and are defined by files in16:46
Keybuk       the  /etc/init  directory.  See init(5) for more details on configuring16:46
Keybuk       Upstart.16:46
Keybuk...16:46
Keybukjust sayin' ;-)16:46
dscyes it does.  I plead guilty to a breadth-first scan of man. :)16:46
Keybukyeah, I seem to like lots of smaller manpages16:47
Keybukrather than one big one16:47
dscI noticed one google hit that mentioned "service" in a job.  I don't find that in init(5).  Is that newer?16:50
=== dsc is now known as dcorbin_work
Keybukdcorbin_work: no, in fact "service" in a job predates any significant shipped version of Upstart18:12
Keybukall versions you're ever likely to encounter use "task" instead for the opposite (the default has been service since 0.5.0)18:13
dcorbin_workKeybuk: should I see it in init(5)?18:15
Keybukdcorbin_work: not anymore18:17
Keybukthe term is used still, but there is no config keyword18:17
dcorbin_workGot it. Thanks18:17
dcorbin_workIs there a log made of all upstart events?19:01
dcorbin_work(or a setting to have it log such)19:03
JanCdcorbin_work: read about "log-priority" in "man initctl"20:32
JanCand about "--verbose" in init(5)20:33
JanCin init(8) I mean20:33
Keybukion: I'm still trying to work out *why* shells are behaving like that (re: 619269)21:19
ionPerhaps for the very reason that the script closing a file descriptor doesn’t break the shell’s reading of the input file.21:20
Keybukthe shell doesn't really know21:20
Keybukso far it seems to be a side-effect of another behaviour21:20
Keybukoh, I see21:22
Keybukthe input file descriptor is "saved"21:23
Keybukwhich means moving it to be >= 10 as permitted by POSIX21:23
KeybukI think I'm being a numpty here anyway21:24
Keybukyes, I am21:26
Keybukif only this was p921:27
ionWhat does plan9 do?21:27
Keybukin p9, we could just create a pipe21:28
Keybukand pass the path of that pipe as a filename ;)21:28
ionAm i wrong in assuming that Upstart could simply use a fd <10 for the shell’s half of the pipe and insert the prefix 'exec n<&-;' to scripts?21:34
Keybuksee my most recent comment21:35
ionah :-)21:35
Keybukkeybuk@keybuk:~$ ls -l /proc/self/fd21:37
Keybuktotal 021:37
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:37 0 -> /dev/pts/221:37
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:37 1 -> /dev/pts/221:37
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:37 2 -> /dev/pts/221:37
Keybuklr-x------ 1 keybuk eng 64 Mar 16 14:37 3 -> /proc/20482/fd21:37
Keybuk...21:37
Keybukwhere is that #3 coming from?! :p21:37
ionIt’s the dir opened by ls to do its thing :-)21:37
Keybukkeybuk@keybuk:~$ ls -l /proc/$$/fd21:38
Keybuktotal 021:38
Keybuklr-x------ 1 keybuk eng 64 Mar 16 14:09 0 -> /dev/pts/221:38
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:09 1 -> /dev/pts/221:38
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:09 2 -> /dev/pts/221:38
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:38 255 -> /dev/pts/221:38
Keybuk...21:38
Keybukeven funnier, 255 ?!21:38
ionYeah, bash did: dup2(3, 255)                            = 25521:38
Keybukwhy did bash do that?21:38
Keybukwhat was that 3 originally?21:39
ionthe input file parameter opened21:39
Keybukthat was just "exec bash"21:39
Keybukit must be a bash-y thing I guess21:39
Keybukkeybuk scripts% ls -l /proc/20541/fd21:40
Keybuktotal 021:40
Keybuklr-x------ 1 keybuk eng 64 Mar 16 14:39 0 -> /dev/pts/221:40
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:39 1 -> /dev/pts/221:40
Keybuklr-x------ 1 keybuk eng 64 Mar 16 14:39 10 -> /dev/tty21:40
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:39 2 -> /dev/pts/221:40
Keybukkeybuk scripts% ls -l /proc/20603/fd21:40
Keybuktotal 021:40
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:40 0 -> /dev/pts/221:40
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:40 1 -> /dev/pts/221:40
Keybuklrwx------ 1 keybuk eng 64 Mar 16 14:40 2 -> /dev/pts/221:40
Keybukdash keeps a tty open at #10 ;-)21:40
Keybukbut most importantly doesn't leak it21:41
ionYeah, none of them seem to.21:42
Keybukkeybuk init# ps w -p 3115821:45
Keybuk  PID TTY      STAT   TIME COMMAND21:45
Keybuk31158 ?        Ss     0:00 /bin/sh -e /proc/self/fd/1221:45
Keybukkeybuk init# ls -l /proc/31158/fd21:45
Keybuktotal 021:45
Keybuklrwx------ 1 root root 64 Mar 16 14:44 0 -> /dev/null21:45
Keybuklrwx------ 1 root root 64 Mar 16 14:44 1 -> /dev/null21:45
Keybuklr-x------ 1 root root 64 Mar 16 14:44 12 -> pipe:[4648423]21:45
Keybuklrwx------ 1 root root 64 Mar 16 14:44 2 -> /dev/null21:45
Keybuklr-x------ 1 root root 64 Mar 16 14:44 255 -> pipe:[4648423]21:45
Keybukkeybuk init# ls -l /proc/31159/fd21:45
Keybuktotal 021:45
Keybuklrwx------ 1 root root 64 Mar 16 14:44 0 -> /dev/null21:45
Keybuklrwx------ 1 root root 64 Mar 16 14:44 1 -> /dev/null21:45
Keybuklr-x------ 1 root root 64 Mar 16 14:44 12 -> pipe:[4648423]21:45
Keybuklrwx------ 1 root root 64 Mar 16 14:44 2 -> /dev/null21:45
Keybuk...21:45
Keybukwhereas 12 is definitely leaked there21:45
Keybukthe shell actually has the file opened as #255 too21:45
ionyeah21:45
Keybukso close(12) wouldn't actually close the file21:46
Keybukof course21:49
Keybukthis is all another reason we can't support "perl script" ;-)21:49
KeybukI'm such an evil cunt22:11
Keybuksince a year has now passed since the MOST ANNOYING BUG EVAH was filed22:12
KeybukI only now fix it22:12
Keybukbecause it was too much fun leaving it open for the screaming idiots22:12
Keybuk(522197)22:12
ionhah22:16
Keybuksigh, it appears that Lennart is posting to upstart-devel with An Opinion ;-)23:21
ionThe message from ~30 minutes ago or something that hasn’t made it into my mailbox yet?23:31

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