Magellan Linux

Contents of /trunk/usbip/usbippolld-sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 184 - (show annotations) (download)
Tue May 15 08:21:23 2007 UTC (17 years ago) by niro
File size: 870 byte(s)
-fixed timeout polling, do not wait after evry client but after evry cycle

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 id from clients")
9
10 for client in ${ALLCLIENTS}
11 do
12 clientip=$(mysqldo "select ip from clients where id='${client}'")
13
14 if [[ $(mysqldo "select connected from clients where id='${client}'") = 1 ]]
15 then
16 BUSID=$(mysqldo "select busid from clients where id='${client}'")
17
18 echo "-- polling client #${client} - ${clientip} on dev ${BUSID}"
19 usbip -a ${clientip} ${BUSID}
20 else
21 echo "-- client #${client} - ${clientip} not found, removing from list"
22
23 out=$(mktemp)
24 port=$(usbip -p &> ${out};grep -B3 -i "${clientip}" ${out} | grep Port | cut -d' ' -f2| sed "s|:||")
25 [[ ! -z ${port} ]] && usbip -d ${port}
26 #mysqldo "delete from client where id='${client}'"
27 fi
28
29 done
30
31 sleep ${USBIP_WAIT_TIMEOUT}
32 done

Properties

Name Value
svn:executable *