Magellan Linux

Contents of /trunk/usbip/usbippolld-sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 179 - (show annotations) (download)
Thu May 10 14:13:41 2007 UTC (17 years ago) by niro
File size: 713 byte(s)
-fixed include path
-removed commented cruft
-moved sql settings to config file

1 #!/bin/bash
2
3 source /etc/conf.d/usbippolld
4 source /usr/lib/alxconfig-ng/functions/mysqlfunctions
5
6 while true
7 do
8 ALLCLIENTS=$(mysqldo "select ip from clients")
9
10 for client in ${ALLCLIENTS}
11 do
12 if [[ $(mysqldo "select connected from clients where ip='${client}'") = 1 ]]
13 then
14 BUSID=$(mysqldo "select busid from clients where ip='${client}'")
15
16 echo "-- polling client ${client} on dev ${BUSID}"
17 usbip -a ${client} ${BUSID}
18 else
19 echo "-- client ${client} not found, removing from list"
20
21 out=$(mktemp)
22 port=$(usbip -p &> ${out};grep -B3 -i "${client}" ${out} | grep Port | cut -d' ' -f2| sed "s|:||")
23 [[ ! -z ${port} ]] && usbip -d ${port}
24 fi
25
26 sleep ${USBIP_WAIT_TIMEOUT}
27 done
28 done

Properties

Name Value
svn:executable *