bencI want to use upstart for mochiweb - an erlang web server01:13
bencthe server knows how to kill itself so usualy people use a script that tells erlang to stop the server and the erlang VM01:14
bencin upstart the stop event kill the process so aren't they both doing the same thing?01:14
=== ion__ is now known as ion
babelI'm playing with upstart and would like to run a script before runlevel [016]. I tried several ways to express what I want but "start on starting runlevel [016]" seems to be right but my job doesn't start. I've tested the script before with initctl emit test and that was fine. any ideas?08:50
babelnote: the script should shutdown any running kvm guest with virsh shutdown.08:51
bencwhat does this means 'stop on runlevel [!023456]'12:33
bencI'm trying to understand when I should stop my server. It's a web server12:34
ionEffectively ‘stop on runlevel 1’, as long as [0123456] are the only runlevel event parameters. ‘start on filesystem’, ‘stop on runlevel [06]’ might be appropriate for Ubuntu 9.10.12:37
bencion: hi, you helped me yesterday. for a mochiweb app, when do I need to stop it? do I need the [!023456] or something else?12:39
ion‘start on filesystem and net-device-up’ instead of ‘start on filesystem’ might be appropriate for a network service.12:40
ion‘stop on runlevel [06]’ probably works.12:40
=== pocek_ is now known as pocek
bencwhat about 'start on startup' and 'stop on shutdown' ?12:41
bencok. I want to be sure that the network is up12:41
ion‘start on stopped rc RUNLEVEL=[2345]’ to start after the entire rc2 has been run.12:42
bencdo I need to wait for the entire rc2?12:42
ionDepends. You might not even need to wait for a network device, if the service listens on all present and future interfaces. I don’t remember what mochiweb does by default.12:43
bencI don't mind waiting. startup speed is not very important as long as it's reliable. it just help me understand how stuff work12:46
ionWe probably should have networking emit an event when *all* interfaces defined in /e/n/i are up. That would be reliable. In fact, waiting for the entire rc2 to finish doesn’t really guarantee all network devices are up. They just probably are. :-) ‘start on net-device-up’ only guarantees one interface is up. Currently one could do ‘start on filesystem and net-device-up ethfoo and net-device-up ethbar’ to make sure ethfoo and ethbar are up.12:49
bencare you missing couple of and in the last example?12:53
bencwhat do I need to replace ethfoo and ethbar with?12:53
bencall I want is to start a web server reliably :) couldn't find nginx or apache examples12:54
ionThe names of the network interfaces (‘auto ethfoo’ entries in /etc/network/interfaces)12:54
bencit should be protable. I want to use the same job on my dev machine and on vps hosting12:55
bencion: I've created a job for my mochiweb app but the status is stop/waiting13:25
benc1ion: any idea?14:08
=== ev1 is now known as ev
ionbenc: Add ‘exec >/tmp/log 2>&1’ just after the ‘script’ line, start the job and look at the log.16:20
sadmacKeybuk: I've had some thoughts on respawn16:33
sadmacand limits thereof16:33
ionFor each job, have an integer respawn_delay initialized to 1. Whenever the job dies, respawn_delay *= 2; respawn_delay -= number_of_seconds_the_job_was_running_before_it_died * 1; respawn_delay = clip (respawn_delay, 1, 300); respawn_after (respawn_delay);  // TODO tune the constants16:39
sadmacion: something quite like that, yes.16:39
sadmacKeybuk: new bug filed. You're welcome19:42
Keybuksadmac: no it doesn't19:46
sadmacKeybuk: it doesn't?19:47
Keybuknot here19:47
sadmacKeybuk: ...oops. I accidentally 0.319:48
sadmacKeybuk: its a 0.3 bug19:49
Keybuk0.6 is no different in this regard19:49
sadmacKeybuk: apparently it is. over here init has 3 persistant connections to /dev/console19:49
Keybukyes, stdin, stdout, stderr19:50
Keybukwing-commander scott% sudo ls -l /proc/1/fd19:50
Keybuktotal 019:50
Keybuklrwx------ 1 root root 64 2009-11-20 13:50 0 -> /dev/console19:50
Keybuklrwx------ 1 root root 64 2009-11-20 13:50 1 -> /dev/console19:50
Keybuklrwx------ 1 root root 64 2009-11-20 13:50 2 -> /dev/console19:50
sadmacKeybuk: oh, so it does have the /dev/console, but the SAK key doesn't kill it for you?19:50
sadmacKeybuk: yeah, that's because X is on tty1 here19:50
KeybukX is on tty719:51
sadmacthat seems to be the killer19:51
Keybukso you're probably killing X, not init19:52
sadmacKeybuk: killing X is desirable19:52
sadmacKeybuk: its also killing init19:52
KeybukI can't see anything that indicates why it would19:53
Keybukfor a start, SAK only applies to a TTY19:53
sadmacwhat do you mean?19:54
KeybukSAK is handled in the TTY code19:57
Keybuk/dev/console is not a tty19:57
sadmacKeybuk: init and X are on the same tty for us19:58
Keybukinit isn't on a TTY19:59
sadmacKeybuk: it has open FDs to the active tty19:59
nottingsadmac: but if it's /dev/console, then it theoretically would kill it on whatever tty you did SAK on20:00
nottingnot just tty120:00
Keybukbut since /dev/console is separate to the tty later20:01
Keybuk(it's not /dev/tty0)20:01
Keybukit won't20:01
sadmacKeybuk: not what the kernel docs say20:01
Keybukwhich docs?20:02
sadmacKeybuk: Documentation/SAK.txt20:02
sadmacKeybuk: "On the PC keyboard, SAK kills all applications which have /dev/console opened."20:02
Keybuksee the first line20:03
KeybukLinux 2.4.2 Secure Attention Key (SAK) handling20:03
Keybuk      ~~~~~20:03
sadmacthere is that, isn't there...20:03
Keybukthe sysrq.txt docs say "given console"20:03
Keybuksysvinit holds /dev/console open too20:04
sadmacKeybuk: its by SID from the foreground console20:12
sadmacand nothing on fedora has SID 1 but init20:12
sadmacKeybuk: session id20:13
sadmacKeybuk: the code is 1) get foreground tty. 2) get tty->session 3) kill processes with that session ID20:13
Keybukso why doesn't it kill init on other ttys?20:14
Keybukbecause getty will take the session20:14
sadmacKeybuk: I dunno if we should call that an upstart bug. Its kind of a sloppy mess20:15
sadmacKeybuk: in an abstract sense, tty1 should have X's session ID.20:16
Keybukit should20:21
Keybukin fact, X will sulk heavily (ie. crash) if something else takes it20:21
Keybukbut tty1 is in KD_GRAPHICS mode20:21
Keybukso all bets are off20:21
sadmacKeybuk: will TIOCSCTTY fail in graphics mode?20:22
Keybukno idea20:22
sadmacmight be worth a shot20:22
sadmacnotting: thoughts on all this?20:22
notting(on a conf call, not reading yet)20:23
sadmacKeybuk: If upstart does close stdin/out/err, that would get it as well, would it not?20:24
Keybuk"get it" ?20:25
sadmacKeybuk: kill the bug20:26
sadmacI don't know what the session would become in that case, but you can't be the controller for a terminal that you don't have open, can you?20:27
Keybukno idea20:28
sadmacKeybuk: I thought you were the font of obscure tty behavior :)20:28
sadmactime to go screw around with it. /me waits for $dayjob to end/20:28
wasabiKeybuk, you guys doing dinner anywhere tonight? I'd love to meet up with ya.20:54
Keybukthere's the BBQ and AllStars event at the hotel20:56
wasabii haven't been by at all. been swamped at Real Job20:57
nottingsadmac: hey, that bug has a dup21:07
sadmac_homenotting: really?21:15
nottingyeah, someone filed a bug against X about it21:15
benc2if I need to export HOME, do I do this at the top of the job or inside the script/end script ?22:00

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