1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| #!/bin/sh
| # 查询版本信息
| echo -en "Content-type: text/html; charset=utf-8\n\n"
| #*****************************************************
| source ../bin/env.sh
| db="../bin/db"
|
| str=`uptime`
| str1="${str#*up}"
| operation="${str1%%,*}"
| #echo $operation
|
|
| str2=`cat /usr/local/version`
| str3="${str2%
| *}"
| str4="${str3#*
| }"
| software="${str3%%
| *} V$str4"
|
| str5=`cat /home/version`
| str6="${str5%
| *}"
| str7="${str5#*
| }"
| firmware="$str6 V$str7"
|
| hardware=V2.0
|
|
| data="$firmware,$software,$hardware,$operation"
|
| content=`$db query_version "$data"`
| if [ $? -eq 0 ]
| then
| echo "$content"
| else
| echo "[]"
| fi
|
| #echo "query version: $content" > log
|
|
|