/srv/irclogs.ubuntu.com/2012/02/29/#upstart.txt

sveinseIs there a way to stop a service from starting? E.g. during boot and within a job's script I want to stop another future job from starting. I can't control the other job's stanzas and it starts on runlevel09:14
sveinseCan I do that? This is on Ubuntu Natty, so its an older version of upstart09:14
dkogananybody around to aid in defining an upstart .conf file?20:16
SpamapSdkogan: where are you stuck?20:39
dkoganSpamapS: Wrangling with basic of upstart's event-orientation instead of state-orientation21:16
dkoganI'd like my job to run when a particular USB device is plugged in AND when a network device is up21:17
dkoganeither one is simple. but when I 'start on aaa and bbb', it doesn't work for post-boot USB insertions/removals21:17
dkoganso at boot it get the USB-inserted and network-up events, and runs the job21:18
dkoganthen I pull the USB cable; upstart sees this and stops the job21:18
dkoganthen I re-insert the cable. Upstart sees the usb-inserted event, but NO network-up event and doesn't start my job again21:19
dkoganthis is really by design, since the network-up event is long-gone at that point. I essentially want a 'network-up' state and not a 'network-up' event. Is there a common idiom for this?21:19
dkoganThanks21:20
SpamapSdkogan: right, basically you have a special case (at boot) and then hot-plug ..21:29
SpamapSdkogan: simplest thing to do is probably to just wait in pre-start until the network is available in the way you need it21:30
dkoganok. I see21:34
dkoganthanks21:34
SpamapSdkogan: there are ways to make upstart coordinate it exactly.. but I think they'd complicate things more than simply testing that your desired network configuration is available21:36
SpamapSdkogan: another option is to work a bit like mountall.. just start up and wait for a signal, then send the signal to the daemon whenever new network interfaces come up.21:38
dkoganI'm ok with extra complexity if it makes things work "right". Let me look at mountall22:06
SpamapSdkogan: the basic method it uses is to always try to mount everything... and then re-try whenever it gets SIGUSR122:30
SpamapSdkogan: so for NFS volumes, it just tries every time a network interface comes up.22:30
dkoganok. but here "it" is mountall, NOT upstart, right?22:32
dkoganseems like this is something upstart should be able to do itself22:32
dkoganI think I'll change all my conditions to 'or' instead of 'and' and simply re-check them before running the daemon. so upstart will trigger multiple times, but my "exec" stanza will make sure that everything is up that needs to be22:33
SpamapSdkogan: right22:34
dkoganwhile you're here, another semi-related question22:35
dkoganI'm seeing that the usb-device-added event isn't triggered at bootup reliably22:35
dkoganworks about 80% of the time, but not 100%22:35
dkoganI set the loglevel to debug and it's clearly not there when it doesn't work22:36
SpamapSdkogan: even right after a udevadm settle ?22:36
dkoganmaybe....22:36
dkoganthis would be in the log?22:36
SpamapSdkogan: well it happens early in boot right after udev is started22:36
dkoganlooking at the log, usb-device-added appears when it works and does not appear when it doesn't; "udevadm" never appears in either case22:38
dkoganthis with --verbose22:38
SpamapSdkogan: I don't know that anything eill be logged22:38
dkoganalso, older upstart; 0.6.5 (from ubuntu lucid). Tried up to 0.9.something and it was still broken 20% of the time22:38
SpamapSdkogan: this is a udev issue, not an upstart issue22:39
dkoganok. any debugging tips?22:39
dkoganeven when upstart doesn't see the device at boot, udev does22:40
dkoganthe device is there and works fine22:40
SpamapSdkogan: not really.. USB is outside my server-centric realm22:40
dkoganok. thanks for listening :)22:40
SpamapSdkogan: so upstart's udev bridge starts *before* udev.. so if udev sees it and emits the event, then so shall upstart, in theory.22:40
dkoganudev definitely sees it. I have a udev rule set up to make symlinks to the device, and those are there always22:41
dkogananother interesting data point is that the boot takes about twice as long when it doesn't work...22:47
SpamapSdkogan: interesting indeed23:05

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