udev ACTION add isn't working
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to use udev for some basic actions, in this case the idea is to launch a simple script. The problem is that when I use this rule:
ACTION=="remove", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
It runs perfect, but if I use this one:
ACTION=="add", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
No action is done! I'm trying to trigger an action when an usb with a label "NAMEHERE" is connected, NOT disconnected.
linux kernel usb udev devices
add a comment |Â
up vote
0
down vote
favorite
I'm trying to use udev for some basic actions, in this case the idea is to launch a simple script. The problem is that when I use this rule:
ACTION=="remove", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
It runs perfect, but if I use this one:
ACTION=="add", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
No action is done! I'm trying to trigger an action when an usb with a label "NAMEHERE" is connected, NOT disconnected.
linux kernel usb udev devices
Quick shot: It may not have the ID_FS_LABEL at the point where you are calling the rule, because it will need to run some other rule (callingblkid
or whatever, can't remember) to determine the label in the first place.
â dirkt
Sep 13 at 12:24
First at all, thanks for your time dirkt... blkid os similar before using this rule maybe?
â Brokes
Sep 13 at 12:26
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to use udev for some basic actions, in this case the idea is to launch a simple script. The problem is that when I use this rule:
ACTION=="remove", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
It runs perfect, but if I use this one:
ACTION=="add", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
No action is done! I'm trying to trigger an action when an usb with a label "NAMEHERE" is connected, NOT disconnected.
linux kernel usb udev devices
I'm trying to use udev for some basic actions, in this case the idea is to launch a simple script. The problem is that when I use this rule:
ACTION=="remove", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
It runs perfect, but if I use this one:
ACTION=="add", ENVID_FS_LABEL=="NAMEHERE", KERNEL=="sd[a-z][0-9]", RUN+="/home/foobar/Scrapyard/the_script.sh"
No action is done! I'm trying to trigger an action when an usb with a label "NAMEHERE" is connected, NOT disconnected.
linux kernel usb udev devices
linux kernel usb udev devices
edited Sep 16 at 23:31
Jeff Schaller
33.1k849111
33.1k849111
asked Sep 13 at 12:17
Brokes
111
111
Quick shot: It may not have the ID_FS_LABEL at the point where you are calling the rule, because it will need to run some other rule (callingblkid
or whatever, can't remember) to determine the label in the first place.
â dirkt
Sep 13 at 12:24
First at all, thanks for your time dirkt... blkid os similar before using this rule maybe?
â Brokes
Sep 13 at 12:26
add a comment |Â
Quick shot: It may not have the ID_FS_LABEL at the point where you are calling the rule, because it will need to run some other rule (callingblkid
or whatever, can't remember) to determine the label in the first place.
â dirkt
Sep 13 at 12:24
First at all, thanks for your time dirkt... blkid os similar before using this rule maybe?
â Brokes
Sep 13 at 12:26
Quick shot: It may not have the ID_FS_LABEL at the point where you are calling the rule, because it will need to run some other rule (calling
blkid
or whatever, can't remember) to determine the label in the first place.â dirkt
Sep 13 at 12:24
Quick shot: It may not have the ID_FS_LABEL at the point where you are calling the rule, because it will need to run some other rule (calling
blkid
or whatever, can't remember) to determine the label in the first place.â dirkt
Sep 13 at 12:24
First at all, thanks for your time dirkt... blkid os similar before using this rule maybe?
â Brokes
Sep 13 at 12:26
First at all, thanks for your time dirkt... blkid os similar before using this rule maybe?
â Brokes
Sep 13 at 12:26
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Now, with some extra research, the problem fixed or at least I think so:
# If not an usb... End the execution
KERNEL!="sd[a-z][0-9]", GOTO="media_mount_end"
# Import FS infos
IMPORTprogram="/sbin/blkid -o udev -p %N"
ACTION=="add", ENVID_FS_LABEL=="PERAMA", RUN+="/home/gizquierdo/Scrapyard/elScriptejo.sh"
LABEL="media_mount_end"
1
I guess a cleaner solution would be to let the other rule which doesblkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.
â dirkt
Sep 13 at 13:28
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Now, with some extra research, the problem fixed or at least I think so:
# If not an usb... End the execution
KERNEL!="sd[a-z][0-9]", GOTO="media_mount_end"
# Import FS infos
IMPORTprogram="/sbin/blkid -o udev -p %N"
ACTION=="add", ENVID_FS_LABEL=="PERAMA", RUN+="/home/gizquierdo/Scrapyard/elScriptejo.sh"
LABEL="media_mount_end"
1
I guess a cleaner solution would be to let the other rule which doesblkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.
â dirkt
Sep 13 at 13:28
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
add a comment |Â
up vote
1
down vote
Now, with some extra research, the problem fixed or at least I think so:
# If not an usb... End the execution
KERNEL!="sd[a-z][0-9]", GOTO="media_mount_end"
# Import FS infos
IMPORTprogram="/sbin/blkid -o udev -p %N"
ACTION=="add", ENVID_FS_LABEL=="PERAMA", RUN+="/home/gizquierdo/Scrapyard/elScriptejo.sh"
LABEL="media_mount_end"
1
I guess a cleaner solution would be to let the other rule which doesblkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.
â dirkt
Sep 13 at 13:28
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Now, with some extra research, the problem fixed or at least I think so:
# If not an usb... End the execution
KERNEL!="sd[a-z][0-9]", GOTO="media_mount_end"
# Import FS infos
IMPORTprogram="/sbin/blkid -o udev -p %N"
ACTION=="add", ENVID_FS_LABEL=="PERAMA", RUN+="/home/gizquierdo/Scrapyard/elScriptejo.sh"
LABEL="media_mount_end"
Now, with some extra research, the problem fixed or at least I think so:
# If not an usb... End the execution
KERNEL!="sd[a-z][0-9]", GOTO="media_mount_end"
# Import FS infos
IMPORTprogram="/sbin/blkid -o udev -p %N"
ACTION=="add", ENVID_FS_LABEL=="PERAMA", RUN+="/home/gizquierdo/Scrapyard/elScriptejo.sh"
LABEL="media_mount_end"
edited Sep 16 at 23:32
Jeff Schaller
33.1k849111
33.1k849111
answered Sep 13 at 12:34
Brokes
111
111
1
I guess a cleaner solution would be to let the other rule which doesblkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.
â dirkt
Sep 13 at 13:28
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
add a comment |Â
1
I guess a cleaner solution would be to let the other rule which doesblkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.
â dirkt
Sep 13 at 13:28
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
1
1
I guess a cleaner solution would be to let the other rule which does
blkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.â dirkt
Sep 13 at 13:28
I guess a cleaner solution would be to let the other rule which does
blkid
anyway run first, or it'll get run twice... but that means you'll need to find out which rule this is. But if you don't mind the extra overhead, do whatever works for you.â dirkt
Sep 13 at 13:28
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
Perfect, thanks dirkt!
â Brokes
Sep 13 at 13:59
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f468783%2fudev-action-add-isnt-working%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Quick shot: It may not have the ID_FS_LABEL at the point where you are calling the rule, because it will need to run some other rule (calling
blkid
or whatever, can't remember) to determine the label in the first place.â dirkt
Sep 13 at 12:24
First at all, thanks for your time dirkt... blkid os similar before using this rule maybe?
â Brokes
Sep 13 at 12:26