Magellan Linux

Diff of /trunk/usbip/usbippolld-sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 179 by niro, Thu May 10 14:13:41 2007 UTC revision 181 by niro, Thu May 10 15:02:35 2007 UTC
# Line 5  source /usr/lib/alxconfig-ng/functions/m Line 5  source /usr/lib/alxconfig-ng/functions/m
5    
6  while true  while true
7  do  do
8   ALLCLIENTS=$(mysqldo "select ip from clients")   ALLCLIENTS=$(mysqldo "select id from clients")
9    
10   for client in ${ALLCLIENTS}   for client in ${ALLCLIENTS}
11   do   do
12   if [[ $(mysqldo "select connected from clients where ip='${client}'") = 1 ]]   clientip=$(mysqldo "select ip from clients where id='${client}'")
13    
14     if [[ $(mysqldo "select connected from clients where id='${client}'") = 1 ]]
15   then   then
16   BUSID=$(mysqldo "select busid from clients where ip='${client}'")   BUSID=$(mysqldo "select busid from clients where id='${client}'")
17    
18   echo "-- polling client ${client} on dev ${BUSID}"   echo "-- polling client #${client} - ${clientip} on dev ${BUSID}"
19   usbip -a ${client} ${BUSID}   usbip -a ${clientip} ${BUSID}
20   else   else
21   echo "-- client ${client} not found, removing from list"   echo "-- client #${client} - ${clientip} not found, removing from list"
22    
23   out=$(mktemp)   out=$(mktemp)
24   port=$(usbip -p &> ${out};grep -B3 -i "${client}" ${out}  | grep Port | cut -d' '  -f2| sed "s|:||")   port=$(usbip -p &> ${out};grep -B3 -i "${clientip}" ${out}  | grep Port | cut -d' '  -f2| sed "s|:||")
25   [[ ! -z ${port} ]] && usbip -d ${port}   [[ ! -z ${port} ]] && usbip -d ${port}
26     #mysqldo "delete from client where id='${client}'"
27   fi   fi
28    
29   sleep ${USBIP_WAIT_TIMEOUT}   sleep ${USBIP_WAIT_TIMEOUT}

Legend:
Removed from v.179  
changed lines
  Added in v.181