ENV vs ATTR in udev rules?

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm trying to automount a usb to my raspberry pi, but I can't seem to get my udev rule to work.
The code I'm using is:
ACTION=="add", ENVID_MODEL=="Flash_Drive", RUN+="bin/mkdir /home/pi/heyimhere"
This doesn't work as no directory at that location is created as the flash drive is being plugged in.
I had luck using usb to shut down using the same rules, this time shutting it down using this line:
ACTION=="remove", ENVID_MODEL=="Flash_Drive", RUN+="sbin/shutdown -h now"
Which works - as soon as you remove the usb it shuts down.
Why? Should I use ATTR for add?
udev
add a comment |Â
up vote
2
down vote
favorite
I'm trying to automount a usb to my raspberry pi, but I can't seem to get my udev rule to work.
The code I'm using is:
ACTION=="add", ENVID_MODEL=="Flash_Drive", RUN+="bin/mkdir /home/pi/heyimhere"
This doesn't work as no directory at that location is created as the flash drive is being plugged in.
I had luck using usb to shut down using the same rules, this time shutting it down using this line:
ACTION=="remove", ENVID_MODEL=="Flash_Drive", RUN+="sbin/shutdown -h now"
Which works - as soon as you remove the usb it shuts down.
Why? Should I use ATTR for add?
udev
2
A udev rule is the wrong approach. You wantSYSTEMD_WANTS; seeman systemd.device.
â jasonwryan
Nov 5 '17 at 21:50
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm trying to automount a usb to my raspberry pi, but I can't seem to get my udev rule to work.
The code I'm using is:
ACTION=="add", ENVID_MODEL=="Flash_Drive", RUN+="bin/mkdir /home/pi/heyimhere"
This doesn't work as no directory at that location is created as the flash drive is being plugged in.
I had luck using usb to shut down using the same rules, this time shutting it down using this line:
ACTION=="remove", ENVID_MODEL=="Flash_Drive", RUN+="sbin/shutdown -h now"
Which works - as soon as you remove the usb it shuts down.
Why? Should I use ATTR for add?
udev
I'm trying to automount a usb to my raspberry pi, but I can't seem to get my udev rule to work.
The code I'm using is:
ACTION=="add", ENVID_MODEL=="Flash_Drive", RUN+="bin/mkdir /home/pi/heyimhere"
This doesn't work as no directory at that location is created as the flash drive is being plugged in.
I had luck using usb to shut down using the same rules, this time shutting it down using this line:
ACTION=="remove", ENVID_MODEL=="Flash_Drive", RUN+="sbin/shutdown -h now"
Which works - as soon as you remove the usb it shuts down.
Why? Should I use ATTR for add?
udev
edited Nov 5 '17 at 21:43
asked Oct 30 '17 at 15:58
Rocky
113
113
2
A udev rule is the wrong approach. You wantSYSTEMD_WANTS; seeman systemd.device.
â jasonwryan
Nov 5 '17 at 21:50
add a comment |Â
2
A udev rule is the wrong approach. You wantSYSTEMD_WANTS; seeman systemd.device.
â jasonwryan
Nov 5 '17 at 21:50
2
2
A udev rule is the wrong approach. You want
SYSTEMD_WANTS; see man systemd.device.â jasonwryan
Nov 5 '17 at 21:50
A udev rule is the wrong approach. You want
SYSTEMD_WANTS; see man systemd.device.â jasonwryan
Nov 5 '17 at 21:50
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f401432%2fenv-vs-attr-in-udev-rules%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
2
A udev rule is the wrong approach. You want
SYSTEMD_WANTS; seeman systemd.device.â jasonwryan
Nov 5 '17 at 21:50