Question on mdev's custom command invocation
Olivier Brunel
jjk at jjacky.com
Wed Nov 16 17:37:34 UTC 2016
On Wed, 16 Nov 2016 16:27:12 +0100
Didier Kryn <kryn at in2p3.fr> wrote:
> Hello.
>
> I'm willing to create/delete symlinks in /dev/disk/by-uuid and
> /dev/disk/by-label . For this, I've written a script and added the
> following lines to /etc/mdev.conf:
> sd[a-z][0-9]* root:disk 660 */sbin/mdev-disk
> hd[a-z][0-9]* root:disk 660 */sbin/mdev-disk
>
> Note that I use /dev/mdev.seq to serialize events.
>
> Is there a means for my script mdev-disk to determine if the
> device is being inserted or extracted? For example it would be easy
> if mdev provided the uevent's action (add, remove)
I'm assuming you already use environment variables in your script,
e.g. $MDEV, $SEQNUM, etc Maybe you missed $ACTION, sounds like what
you're looking for.
HTH,
> My current trick is to create links when they don't exist and
> delete them when they exist, but it's far from rock-solid.
>
> Possible alternatives I see are:
> - use different commands for insertion and extraction - not
> sure mdev.conf allows to have two lines per device pattern
> - monitor /dev with inotify instead of using a command
> launched by mdev, but this process would be constantly there sleeping.
>
> Thanks for your help.
> Didier
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list