Magellan Linux

Annotation of /trunk/usbip/usbippolld-sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 174 - (hide annotations) (download)
Wed May 9 15:05:23 2007 UTC (17 years ago) by niro
File size: 1282 byte(s)
-sql version

1 niro 174 #!/bin/bash
2    
3     SQL_USER=jomo
4     SQL_PASS=j0m0
5     SQL_HOST=128.20.41.110
6     SQL_DB=jomo
7    
8     source /etc/conf.d/usbippolld
9     source /home/rogalla/cvsroot/alx-src/alxconfig-ng/functions/mysqlfunctions
10    
11     while true
12     do
13     ALLCLIENTS=$(mysqldo "select ip from clients")
14    
15     for client in ${ALLCLIENTS}
16     do
17     # BUSID=$(mysqldo "select busid from clients where ip='${client}'")
18     #
19     # if fping -q ${FPING_OPTS} ${client}
20     # then
21     # echo "-- polling client ${client} on dev ${BUSID}"
22     # usbip -a ${client} ${BUSID}
23     # else
24     # echo "-- client ${client} not found, removing from list"
25     #
26     # out=$(mktemp)
27     # port=$(usbip -p &> ${out};grep -B3 -i "128.20.3.3" ${out} | grep Port | cut -d' ' -f2| sed "s|:||")
28     # usbip -d ${port}
29     # mysqldo "delete from clients where ip='${client}'"
30     # fi
31    
32    
33     if [[ $(mysqldo "select connected from clients where ip='${client}'") = 1 ]]
34     then
35     BUSID=$(mysqldo "select busid from clients where ip='${client}'")
36    
37     echo "-- polling client ${client} on dev ${BUSID}"
38     usbip -a ${client} ${BUSID}
39     else
40     echo "-- client ${client} not found, removing from list"
41    
42     out=$(mktemp)
43     port=$(usbip -p &> ${out};grep -B3 -i "${client}" ${out} | grep Port | cut -d' ' -f2| sed "s|:||")
44     [[ ! -z ${port} ]] && usbip -d ${port}
45     fi
46    
47     sleep ${USBIP_WAIT_TIMEOUT}
48     done
49     done

Properties

Name Value
svn:executable *