add
ļ11-add-usb.rules
ݣ
ACTION!="add",GOTO="END"
KERNEL=="sda[0-9]",RUN+="/etc/mount-usb.sh %k"
LABEL="END"

remove
ļ11-remove-usb.rules
ݣ
ACTION!="remove",GOTO="END"
KERNEL=="sda[0-9]",RUN+="/etc/umount-usb.sh %k.sh"
LABEL="END"

ؽű
ļmount-usb.sh
ݣ
#!/bin/sh
mount  -t vfat /dev/$1 /mnt/usb
sync

жؽű
ļumount-usb.sh
ݣ
#!/bin/sh
sync
umount /mnt/usb
