Problem starting job on a udev/hotplug event
James Hunt
james.hunt at ubuntu.com
Tue Aug 21 16:23:10 UTC 2012
On 21/08/12 14:21, Tim Gopp wrote:
> Hello list,
>
> for a job I need the serial device ttyS1 to be ready. When just starting the
> job "on startup" it happens that ttyS1 is not (yet) available in /dev and my
> service fails
>
> So I try to start the job with this condition:
>
> start on tty-device-added DEVNAME=ttyS1
>
> but it never starts.
>
> This is the udev log for the device:
> KERNEL[1345554903.692892] add /devices/pnp0/00:07/tty/ttyS1 (tty)
> UDEV_LOG=3
> ACTION=add
> DEVPATH=/devices/pnp0/00:07/tty/ttyS1
> SUBSYSTEM=tty
> DEVNAME=ttyS1
> SEQNUM=1253
> MAJOR=4
> MINOR=65
>
>
> Wo what am I doing wrong? This is upstart 0.6.5-8 from Ubuntu 10.04LTS.
>
> regards,
> Tim
>
>
Hi Tim,
You're looking at the wrong udev entry there - if you look at the
corresponding "UDEV [...]" (as opposed to "KERNEL [...]") entry, you'll
see that DEVNAME variable actually includes a path:
DEVNAME=/dev/ttyS0
So, to fix your problem, change the 'start on' condition to:
start on tty-device-added DEVNAME=*ttyS1
A general process to avoid that trap in future is to start with a job
that only specifies the udev subsystem you're interested in like this:
start on tty-device-added
exec env
Then, look at /var/log/upstart/myjob.log and see what variables are
available to you and the format they are in. Then, you can refine the
'start on' accordingly.
I'll add this to the Cookbook...
Kind regards,
James.
--
James Hunt
____________________________________
http://upstart.ubuntu.com/cookbook
http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf
More information about the upstart-devel
mailing list