COUNTER_FILE_LINE_TEMP=0 # echo "$LOG_DMESG_NAME" if [-e $LOG_DMESG_NAME ] then while read UEVENT_STRING[$COUNTER_FILE_LINE_TEMP] do # echo "string [$COUNTER_FILE_LINE_TEMP] = ${UEVENT_STRING[$COUNTER_FILE_LINE_TEMP]}" echo "${UEVENT_STRING[$COUNTER_FILE_LINE_TEMP]}"| awk '{ print $3 $4 }'>> $LOG_UEVENT_MESSAGE_NAME echo "${UEVENT_STRING[$COUNTER_FILE_LINE_TEMP]}"| awk '{ print $3 }'>> $LOG_USB_STORAGE_NAME COUNTER_FILE_LINE_TEMP=`expr $COUNTER_FILE_LINE_TEMP + 1` done < $LOG_DMESG_NAME fi
if [-e $LOG_USB_STORAGE_NAME ] then COUNTER_FILE_LINE_TEMP=0 while read USB_DISK_STRING[$COUNTER_FILE_LINE_TEMP] do # echo "new [$COUNTER_FILE_LINE_TEMP] = ${USB_DISK_STRING[$COUNTER_FILE_LINE_TEMP]}" if ["${USB_DISK_STRING[$COUNTER_FILE_LINE_TEMP]}"=="[sdb]"] then # echo "LIUQI=${USB_DiISK_STRING[$COUNTER_FILE_LINE_TEMP]}" VAR_USB_WITHOUTPARTATION="${USB_DISK_STRING[$COUNTER_FILE_LINE_TEMP]}" VAR_USB_WITHOUTPARTATION="${VAR_USB_WITHOUTPARTATION:1:3}" echo "have find a disk $VAR_USB_WITHOUTPARTATION" rm -rf $LOG_USB_STORAGE_NAME dmesg -c > $LOG_DMESG_NAME break fi COUNTER_FILE_LINE_TEMP=`expr $COUNTER_FILE_LINE_TEMP + 1` done < $LOG_USB_STORAGE_NAME rm -rf $LOG_USB_STORAGE_NAME fi
if [-e $LOG_UEVENT_MESSAGE_NAME ] then while read USB_DISCONNECT_STRING[$COUNTER_FILE_LINE_TEMP] do # echo "liuqi ${USB_DISCONNECT_STRING[$COUNTER_FILE_LINE_TEMP]}" if ["${USB_DISCONNECT_STRING[$COUNTER_FILE_LINE_TEMP]}"=="USBdisconnect,"] then sleep 1 dmesg -c > $LOG_DMESG_NAME # rm -rf $LOG_USB_STORAGE_NAME rm -rf $LOG_DMESG_NAME # rm -rf $LOG_WC_FILE_NAME # rm -rf $LOG_UEVENT_MESSAGE_NAME # exit fi done < $LOG_UEVENT_MESSAGE_NAME rm -rf $LOG_UEVENT_MESSAGE_NAME fi
if [ $TEMP_FILE_LINE_NUM -gt 3 ] then sleep 0.1 # break; fi