[systemd-devel] udev rules environment variable

Hannes Reinecke hare at suse.de
Mon Dec 16 23:56:31 PST 2013


On 12/17/2013 08:52 AM, Robert Milasan wrote:
> Hello,
>   got a small question about creating a rule, like this:
> 
> ACTION=="add", ...., ENV{test_device}="1"
> 
> ACTION=="remove, ...., ENV{test_device}=="1",
> RUN+="/path/to/some/script"
> 
> Does udev save test_device variable someplace and then it can be used
> later on, when have ACTION=="remove" ?
> 

Typically not.
I would be using external tools for that, like 'collect'

Might be biased, though, what with me having written it ...

And the alternative of querying the udev database from within an
udev event is just plain ugly and prone to races.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare at suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


More information about the systemd-devel mailing list