-
Notifications
You must be signed in to change notification settings - Fork 22
/
fripadm
70 lines (66 loc) · 1.53 KB
/
fripadm
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
function print_usage() {
echo " fripadm version 0.82 by [email protected]"
echo " fripadm usage: fripadm:find/insert/delete/delete all/switch/rebuild/dump"
echo
echo "#fripadm insert '192.168.31.98 127.*.*.* 255.*.*.1-100'"
echo "#fripadm switch"
echo "#fripadm find 127.3.4.7 "
echo "#fripadm delete 127.0-255.*.*"
echo "#fripadm switch"
echo "#fripadm find 127.3.4.7 "
echo "#fripadm rebuild 1025 3199"
echo "#fripadm find 192.168.31.98 "
echo "#fripadm dump "
echo "#fripadm dump ip"
echo "#fripadm dump struct"
echo "#fripadm dump numbers"
}
if [ "$#" -eq 0 ]
then
print_usage &>/proc/self/fd/2
exit 1
fi
if [ "$1" = "find" ]
then
./fripadm_exe 2 "$2"
elif [ "$1" = "insert" ]
then
./fripadm_exe 4 "$2"
elif [ "$1" = "delete" ]
then
./fripadm_exe 7 "$2"
elif [ "$1" = "delete all" ]
then
./fripadm_exe 8
elif [ "$1" = "switch" ]
then
./fripadm_exe 9
elif [ "$1" = "rebuild" ]
then
./fripadm_exe 10 "$2" "$3"
elif [ "$1" = "dump" ]
then
./fripadm_exe 12
if [ "$2" = "" ]
then
dmesg | grep frdev_dump_struct | tail -1 | tr $ '\n'
dmesg | grep frdev_dump_ip | tail -1 | tr $ '\n'
elif [ "$2" = "ip" ]
then
dmesg | grep frdev_dump_ip | tail -1 | tr $ '\n'
elif [ "$2" = "struct" ]
then
dmesg | grep frdev_dump_struct | tail -1 | tr $ '\n'
elif [ "$2" = "numbers" ]
then
dmesg | grep frdev_dump_numbers | tail -1 | tr $ ' '
else
print_usage &>/proc/self/fd/2
exit 1
fi
else
print_usage &>/proc/self/fd/2
exit 1
fi
exit $?