/srv/irclogs.ubuntu.com/2013/08/02/#upstart.txt

joshumorning anyone around?05:31
joshui'm trying to write a upstart script that will enable mobile broadband when a usb modem is attached. Not sure what start on event should trigger the script05:51
joshuthere's no interface until the wwan if enabled, so i can't use start on net-device-added05:54
ionstart on tty-device-added ID_VENDOR_ID=something ID_MODEL_ID=something ID_IFACE=00, also use /dev/serial/by-id/usb-something_something-if00-port006:08
joshuhi ion have you done this with a usb modem before?06:16
ionyeah06:16
joshuI could use some more help I've been trying for 2 hours and it's driving me insane :(06:18
joshuusing lsusb I got 12d1:143506:18
joshuhuawei06:18
ionRun udevadm info --export-db and take the ID_VENDOR_ID and ID_MODEL_ID entries corresponding to your device verbatim.06:20
ionAlso check that ID_IFACE matches.06:20
joshuok standby please I'm doing this right now06:22
joshuok that was a long list to scroll through06:27
joshuID_VENDOR_ID=12d1 ID_MODEL_ID=143606:28
joshuI don't see an ID_IFACE06:28
joshuoh there are several "groups" od devices….in another one it says if00-port006:30
joshuion what do I do now?06:31
ionIt seems newer systems have ID_USB_INTERFACE_NUM instead.06:34
ionI’m looking at an inactive config from an old setup.06:35
joshuyes I found it 0006:35
joshuion if you're still there how should I use this information?07:06
ionSorry, what information?07:48
joshuthe info I got from running udevadm as you told me to run. I was hoping that as you had done this with usb modems that you could guide me07:53
ionJust add a set of udev properties that uniquely identifies the interface as parameters to the tty-device-added event matcher. ID_VENDOR_ID, ID_MODEL_ID and ID_USB_INTERFACE_NUM probably.07:59
ionThe job should start whenever a matching device is plugged in.08:00
xnoxjodh: abi-compliance-checker now kind of works in saucy.08:02
janchorhello, since Quantal (and also on Raring) my system takes an unusually long time to shutdown (up to 10 sec.). Sometimes I see messages flickering saying "killing all remaining processes failed" and "mount: / is busy". what is the best way to debug such an issue? i have tried to change the log-priority to debug but it seems that nothing gets logged related to shutdown08:04
joshuion I've been trying with something simple like this just to see that the event is trigger and that something happens, but nothing in the upstart log or any file created09:12
joshustart on (tty-device-added DEVNAME=*ttyUSB0 ID_VENDOR_ID=12d1)09:12
joshuecho "upstart" >> /tmp/upstart_test09:12
jodhjanchor: See https://code.launchpad.net/~jamesodhunt/ubuntu/saucy/sysvinit/log-processes-and-open-files-on-shutdown/+merge/163740. I'm waiting for this to get merged.09:28
jodhxnox: kind of?09:29
xnoxjodh: it prints a warning "use gcc << 4.8 to have all checks"09:29
xnoxjodh: but autopkgtest for acc now passes and it's in saucy now, mostly working with 4.8. basically gcc4.8 stopped dumping translation unit files.....09:30
joshuhi jodh xnox have you use tty-device-added and can tell me what I might be doing wrong with the simple script above?09:33
ionDo you have any errors in syslog?09:33
joshuion I couldn't see anything there or in the upstart script's log09:34
ionDoes you ‘echo "upstart"…’ line have ‘exec’ in front?09:35
ionyour09:35
joshuwhen I just did tart on tty-device-added; exec env it worked and logged all the data as we got earlier via udevadm.09:36
joshuno I was looking at examples in the cookbook and they didn't have exec in front so I did the same. But I will try now with exec09:37
ionI mean, a line that just starts with “echo” is an error and you should have an error message in the system log.09:37
ionIf you didn’t find it, you should figure out where it went because that’s where all the parse errors will be in the future as well.09:38
joshuion that was it09:38
joshuok I will remove exec and check the logs again09:38
jodhjoshu: look in /var/log/upstart/*.log. The example I'm looking at in the cookbook for tty-device-added certainly shows "exec env".09:40
joshui can honestly say I can't find an error, but I might have missed it09:40
joshujodh yes I've done that example and you're correct I did it with exec env. But with regards to echo there are many examples with exec in front so I thought that was convention ;)09:41
joshu*without09:41
joshu"echo "start on (event-A and event-B)" >> /etc/init/myjob.override"09:42
ionThat’s not the contents of a job file, that’s a shell command.09:42
joshuthen I'm wrong. my apologies09:46
joshuion do I put the different "matchers" in parentheses or just like this: start on tty-device-added ID_VENDOR_ID=12d1 ID_MODEL_ID=1436 ID_USB_INTERFACE_NUM=0009:48
ionThat should work, i think.09:48
ionI mean, that doesn’t require parentheses for sure.09:49
ionIf the key-value pairs are also exactly right, it ought to work.09:49
joshuok I'm just checking. and for this script should I have a stop event handler?09:50
joshuit's just a "task" right?09:50
ionIf your job will run wvdial/pppd/something like that, you don’t want it to be a “task”.09:53
ionMy job had “stop on runlevel [06] or tty-device-removed <the same pattern as above>”09:54
joshuRight makes sense if it's not a task do I add respawn or daemon or those are also not applicable to this?09:56
ionYou can add “respawn”. I’d avoid “daemon” and just make the program run in foreground.09:57
joshuso just want to make sure I understand. The upstart is triggered when the usb modem is added and is differentiated from other similar devices by the 3 specific attributes. The script will start the mobile broadband connection using nmcli con up id "mobile-connection". If the connection dies the respawn will start it again. Is this correct?10:00
ionI take it nmcli controls another daemon that is running independently and then exits immediately? In that case, you do want “task” and no “stop on” stanza.10:09
ionIn that case, it’s nm’s job to restart the connection.10:09
joshuion so far I've only been successful in echoing when the device is added. When I try to start the connection as I can do manually with nmcli con up id "blah blah" I get an error in upstart log it says10:15
joshu"Error: No suitable device found: no device found for connection "mobile-connection"10:16
ionNetwork-manager probably isn’t ready to start it at the very moment udev sees the tty device.10:24
joshuhmm so do I need to add another start condition?10:26
joshui've tried adding a script block with sleep 10 and then exec nmcli and still the same rror10:47
joshui think I've got it10:50
janchor@jodh thanks, this patch could be useful for my problem, i'm gonna apply it on the respective init scripts and test it10:54
joshuion i got it working with a 20 sec sleep. I've been adding and removing the modem to test and it works well. I'm just not sure about the respawn and task (no stop stanza). I don't know enough how nmcli works. You suggested the latter two.11:07
ionUsing sleep introduces a race condition. If you want to use network-manager for this, you probably shouldn’t use that udev event.11:08
ionCan one not configure network-manager to start the connection automatically?11:08
joshunot for mobile broadband no11:09
joshui've googled and people use a bash script11:10
joshusleep 10; nmcli nm wwan on; nmcli con up id "name"11:10
joshuion https://gist.github.com/anonymous/4a97cdb935c02678101011:12
[diecast]setting up a new init.. http://pastebin.com/QA71qv9S15:12
[diecast]getting "stop: Unknown instance:" when trying to run it15:12
janchor@jodh i have opened a new bug report containing shutdown-lsof.log of my system: https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/120784817:46
ajpIs anyone available to help? trying to figure out why my upstart script (http://pastebin.com/uiXkd901) is not working properly on my headless server.20:49
crankharderis there a main config file?  looking for a way to add an 'include' directory that I can drop additional upstart configs in... other than /etc/init23:56

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