- 论坛徽章:
- 0
|
#!/bin/sh
#
# What to do with this USB hotplug event?
#
case $ACTION in
add)
#echo $ACTION>/dev/tts/0
DIR="/dev/ub"
for I in "$DIR/"*;do
#echo $I>/dev/tts/0
if [ -d $I -a -e $I/part1 ];then
#echo "found&mount $I/part1">/dev/tts/0
mount -t vfat $I/part1 /mnt 2>/dev/tts/0
else
#echo "$I/part1 not found">/dev/tts/0
sleep 1;
if [ -d $I -a -e $I/part1 ];then
#echo "found&mount $I/part1">/dev/tts/0
mount -t vfat $I/part1 /mnt 2>/dev/tts/0
fi
fi
done
;;
remove)
#echo $ACTION>/dev/tts/0
#echo "umount /mnt">/dev/tts/0
umount /mnt 2>/dev/tts/0
;;
*)
exit 1
;;
esac |
用这个文件,可以自动挂载了,可是拔掉u盘时总出现这些错误:
end_request: I/O error, dev uba, sector 4
umount: /usb: Invalid argument
FAT: bread failed in fat_clusters_flush
umount: /usb: Invalid argument
umount: /usb: Invalid argument
umount: /usb: Invalid argument
若朝u盘内写文件,必须要先手动umount才能拔,否则写的内容存不进去,请大家帮我改改程序,看看能不能把手动输入umount的毛病也克服了。请教请教 |
|