/srv/irclogs.ubuntu.com/2007/05/23/#upstart.txt

=== juergbi [n=juerg@80-219-19-101.dclient.hispeed.ch] has joined #upstart
=== Md [i=md@freenode/staff/md] has joined #upstart
=== Keybuk [n=scott@quest.netsplit.com] has joined #upstart
=== cortana [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
=== sadleder [n=sadleder@p50811AF2.dip0.t-ipconnect.de] has joined #upstart
=== sadleder [n=sadleder@p50811AF2.dip0.t-ipconnect.de] has left #upstart []
=== mbiebl [n=michael@e180069225.adsl.alicedsl.de] has joined #upstart
=== tale [n=tale@207.235.54.1] has joined #upstart
=== sadleder [n=sadleder@p50811AF2.dip0.t-ipconnect.de] has joined #upstart
=== sadleder [n=sadleder@p50811AF2.dip0.t-ipconnect.de] has left #upstart []
=== Ack` [n=Ack@213-140-11-128.fastres.net] has joined #upstart
Keybukheh05:56
Keybukso I explained the c-e-c problem to a friend, and it broke him05:56
AlexExtreme:)05:56
Keybukthough he was a sufficient teddy bear for me to figure out two interesting things05:57
Keybuk1)05:57
Keybukstates are more interesting than just discreet05:57
Keybuke.g. if you define a state for tty-added...tty-removed for a common NAME, then there are several questions you can answer05:57
Keybuka) does tty1 exist?05:57
Keybukb) does any tty exist?05:57
Keybukc) what is the list of ttys that exist?05:57
Keybukit turns out that all of these are interesting05:58
Keybukgetty is run for each tty that exists05:58
Keybukbut something requiring a network is running if any non-lo network interface is up05:58
ion_Perhaps upstart should grow a scheme interpreter after all. ;-)06:00
Keybukand the fhs filesystem question can be answers with list-of-mounted-paths is a superset of list-of-required-paths06:01
ion_make states scheme procedures, with a nice API for common things. :-)06:02
=== juergbi [n=juerg@80-219-19-101.dclient.hispeed.ch] has joined #upstart
Keybukthis really does make states first class again06:02
Keybukso a job would end up having event predicates and state predicates06:03
Keybuk2)06:03
Keybukstates don't need to behave like jobs06:03
Keybuk"pre-start"/"post-stop" scripts for states are all very well and pretty06:03
Keybukbut in reality, they're not needed06:03
Keybuksince you can just tie a job to the state, and define the scripts there06:03
ion_True...06:04
ion_But having them in the same file is nice.06:04
ion_OTOH, you could make them separate, implicitly creating an anonymous job for each state, to which the scripts are added.06:05
KeybukI think it makes it more difficult if they're conceptually the same thing06:07
ion_Perhaps add an expr stanza for scheme expressions, which could be used by any job. State would be just a job with no process; there would be no distinction from the codes point of view.06:13
Keybukthe interesting thing about states is the operations on them06:20
Keybukstate-is-true state args...06:20
Keybukany-state-is-true state06:20
Keybukstats-that-are-true state is-subset-of other list06:21
Keybuketc,06:21
=== jonib1 [n=jonas@ua-83-227-144-18.cust.bredbandsbolaget.se] has joined #upstart
=== kylem [n=kyle@amnesiac.heapspace.net] has joined #upstart
=== Md [i=md@freenode/staff/md] has joined #upstart
=== Keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
Keybukho-hum10:30
kylem?10:31
Keybukbrain hurts10:31
kylemstop poking at it10:32
Keybukheh10:32
Keybuktrying to define an elegant language (and internal combustion) for when jobs should be running10:33
ion_How about this? /etc/event.d/tty on tty-added $TTY ... tty-removed $TTY; instance would define a job, which also functions as a state. Other jobs/states could query whether tty is running, but they could also query whether an instance (with a certain $TTY) is running.10:37
ion_In the tty-added $TTY ... tty-removed $TTY expression, the first $TTY (before ...) would be an assignment and the second $TTY (after ...) would be a comparison.10:38
Keybuka job with10:38
Keybukinstance10:38
Keybukstart on tty-added10:38
Keybukstop on tty-removed $TTY10:39
Keybukwould be equivalent10:39
ion_True. :-)10:39
Keybukso you'd end up with two basic stanzas10:40
Keybukstart on/stop on, which define an event or combination of events that start or stop the job10:40
Keybukstart on tty-added or serial-port-added10:40
Keybuketc.10:40
ion_Anyway, that would answer to a) does tty1 exist? b) does any tty exist? c) what is the list of ttys that exist?, wouldnt it?10:40
Keybukyou'd also need a second "when" stanza, that defined the other states that must be true10:40
Keybuk(or maybe while)10:41
Keybuke.g.10:41
Keybukinstance10:41
Keybukstart on tty-added tty[1-6] 10:41
Keybukstop on tty-removed $TTY10:42
Keybukwhile user-can-login10:42
Keybukwhere there's a seperate /etc/?/user-can-login10:42
ion_/etc/job /etc/state? /etc/job.d /etc/state.d?10:43
Keybukthe reason this doesn't feel right to me is that you can't have different pairs of start/stop10:44
Keybuklike the tty or serial-port combo10:44
Keybukyou can't match the stops to the starts10:44
Keybuk:-/10:54
ion_on tty-added tty[1-6]  until tty-removed \1 or serial-port-added * until serial-port-removed \110:56
ion_Or $110:56
Keybukthe problem there is how do you stop them doing:10:59
Keybukfoo until bar until baz10:59
ion_Change11:02
ion_    | cmplx_expr 'until' cmplx_expr11:02
ion_to11:02
ion_    | event 'until' event11:02
Keybukbut then you can't do (event or event) until event11:05
Keybukwhich might be useful11:05
Keybukand how do you define:11:05
Keybuk  any (tty-added until tty-removed $TTY)11:05
ion_expr_no_until : event | expr_no_until 'and' expr_no_until | expr_no_until 'or' expr_no_until | '(' expr_no_until ')' ; expr : expr_no_until | expr_no_until 'until' expr_no_until ;11:09
ion_Correction:11:10
ion_expr_no_until : event | expr_no_until 'and' expr_no_until | expr_no_until 'or' expr_no_until | '(' expr_no_until ')' ; expr : event | expr 'and' expr | expr 'or' expr | '(' expr ')' | expr_no_until 'until' expr_no_until ;11:10
ion_For any (tty-added * until tty-removed $1), create job (state) instance; on tty-added * until tty-removed $1 and check whether it is running.11:12
Keybukwhether any instance is running?11:14
ion_Yes.11:14
Keybukthat gets quite expensive if used a lot, no?11:15
ion_Disconnect state names from the filenames, and make it possible to assign a number of state expressions to variables in a single file?11:17
ion_state tty-exists = any (tty-added tty[1-6]  until tty-removed $1)11:19
ion_state foo = tty-exists and writable-filesystem11:20
=== cortana [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart

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