I try to create some udev rules to mount and unmount my usb flash drives;
the rules for the moment are very simple:

 ACTION=="add",KERNEL=="sd[b-z]",RUN+="/root/scripts/plug_flash_drive.sh %k"
 ACTION=="remove",KERNEL=="sd[b-z]",RUN+="/root/scripts/unplug_flash_drive.sh %k"

plug_flash_drive.sh is also very simple:

 device_name=$1
 mount_options="umask=000,utf8"
 if [ ! -e "/media/$device_name" ]; then
 	mkdir "$mount_dir"
 fi
 sleep 1
 /usr/bin/mount "/dev/$device_name" "/media/$device_name" -o "$mount_options"

unplug_flash_drive.sh:

 device_name=$1
 
 umount "/dev/$device_name"
 rmdir "/media/$device_name"

I have done some tests so I can ascertain that:
- When plugged in, my flash drive is detected, a file is created in /dev
- plug_flash_drive.sh is called by udev
- the mkdir part of the script work
- however it seems that the "mount" part of the script is not executed, so my drive is not mounted
- when I call my script on command line, they perfectly work
- When I unplug my flash drive, unplug_flash_drive.sh is not called by udev

anybody know why mount is not executed when called by udev?