UDEV-Rule 挂载 USB 记忆棒/执行脚本

UDEV-Rule 挂载 USB 记忆棒/执行脚本

我对 udev 规则有疑问。我只是想在插入 USB 记忆棒时挂载它。该规则正确执行一个脚本,该脚本 mkdir 挂载点,然后调用挂载。一切似乎都正常,但棒子从未安装过。如果我手动执行脚本,一切正常,我可以访问棒

/etc/udev/rules.d/usbmount.rules:

KERNEL=="sd?1", SUBSYSTEMS=="usb", ACTION=="add", SYMLINK+="adminStick", RUN+="/usr/bin/logger Start mounting", RUN+="/usr/local/bin/mountAdmin"

/usr/local/bin/mountAdmin:

#!/bin/bash

/usr/bin/logger Creating /media/adminStick 
mkdir -p /media/adminStick

/usr/bin/logger Trying to mount adminStick
mount /dev/adminStick /media/adminStick

日记-f:

Feb 28 19:27:25 alarmpi logger[3691]: Start mounting
Feb 28 19:27:25 alarmpi logger[3693]: Creating /media/adminStick
Feb 28 19:27:25 alarmpi logger[3695]: Trying to mount adminStick
Feb 28 19:27:25 alarmpi kernel: EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: (null)

系统:Raspberry Pi ARMv6 的 Arch

相关内容