Annotation of /trunk/usbip/usbippolld-sql
Parent Directory | Revision Log
Revision 181 -
(hide annotations)
(download)
Thu May 10 15:02:35 2007 UTC (17 years, 4 months ago) by niro
File size: 870 byte(s)
Thu May 10 15:02:35 2007 UTC (17 years, 4 months ago) by niro
File size: 870 byte(s)
-using id rather than the ip-address as primary key
1 | niro | 174 | #!/bin/bash |
2 | |||
3 | source /etc/conf.d/usbippolld | ||
4 | niro | 179 | source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
5 | niro | 174 | |
6 | while true | ||
7 | do | ||
8 | niro | 181 | ALLCLIENTS=$(mysqldo "select id from clients") |
9 | niro | 174 | |
10 | for client in ${ALLCLIENTS} | ||
11 | do | ||
12 | niro | 181 | clientip=$(mysqldo "select ip from clients where id='${client}'") |
13 | |||
14 | if [[ $(mysqldo "select connected from clients where id='${client}'") = 1 ]] | ||
15 | niro | 174 | then |
16 | niro | 181 | BUSID=$(mysqldo "select busid from clients where id='${client}'") |
17 | niro | 174 | |
18 | niro | 181 | echo "-- polling client #${client} - ${clientip} on dev ${BUSID}" |
19 | usbip -a ${clientip} ${BUSID} | ||
20 | niro | 174 | else |
21 | niro | 181 | echo "-- client #${client} - ${clientip} not found, removing from list" |
22 | niro | 174 | |
23 | out=$(mktemp) | ||
24 | niro | 181 | port=$(usbip -p &> ${out};grep -B3 -i "${clientip}" ${out} | grep Port | cut -d' ' -f2| sed "s|:||") |
25 | niro | 174 | [[ ! -z ${port} ]] && usbip -d ${port} |
26 | niro | 181 | #mysqldo "delete from client where id='${client}'" |
27 | niro | 174 | fi |
28 | |||
29 | sleep ${USBIP_WAIT_TIMEOUT} | ||
30 | done | ||
31 | done |
Properties
Name | Value |
---|---|
svn:executable | * |