1#!/bin/sh 2# description: get pid of device's owner 3export LANG="en_US.UTF-8" 4export COLUMNS=256 5LOGFILE="/tmp/lcActiveUSBModem.log" 6 7echo " start to detact device!!! ====" >> $LOGFILE 8if [ "$1" = "" ]; then 9 echo " parameter error" >> $LOGFILE 10 exit 2 11else 12 DEVICE=$1 13fi 14 15BINPID=`/bin/fuser $DEVICE` 16SBINPID=`/sbin/fuser $DEVICE` 17 18if test $BINPID; then 19 echo " /bin/fuser $BINPID has occupied $DEVICE" >> $LOGFILE 20 exit 1 21else 22 echo " /bin/fuser no user occupied $DEVICE" >> $LOGFILE 23fi 24 25if test $SBINPID; then 26 echo " /sbin/fuser $SBINPID has occupied $DEVICE" >> $LOGFILE 27 exit 1 28else 29 echo " /sbin/fuser no user occupied $DEVICE" >> $LOGFILE 30 exit 0 31fi 32 33