[mdlug] Custom udev rule for USB flash drive
Michael ORourke
mrorourke at earthlink.net
Fri Feb 5 22:37:29 EST 2016
On 2/5/2016 3:25 AM, Paul wrote:
> Michael ORourke <mrorourke at earthlink.net>, on Thu 2016.02.04 said:
>
>> My guess is udev does not care if anyone physically touched the
>> flashdrive. All it cares is that it sees a new block device
>> (MySecureVol) that matches the idVendor, idProduct, and serial numbers,
>> so it re-launches the script. Any ideas how to tweak this behavior so
>> that the script will fire each time the device is plugged in, but
>> exclude any /dev/mapper/MySecureVol devices?
>>
>> Thanks,
>> Mike
>>
> Hi;
>
> Well, I dont know much about the udev rules, but the script
> itself can set a flag on initial plug, and just exit if that flag
> is already set. eg. if /dev/mapper/MySecureVol exists...
> Even if you think you have a udev solution, it still might
> make sense to have the script sanity test the state; if the conditions
> the script are meant to enact have already happened, it need not act.
>
> Paul
Paul, thanks for the suggestion. Actually I had thought about setting a
semaphore file and then removing it when the script finishes. But I
suspect that it really isn't much of an issue now that I think about it
more. All I have to do is rename the script or put an exit statement at
the top, then if udev tries to run the script, nothing will happen.
-Mike
More information about the mdlug
mailing list