heron
2017-09-03 8142e1f0ae9b08cb5a8b41adc0d2ef45554702bd
file 정리
2 files modified
53 ■■■■ changed files
README.MD 25 ●●●●● patch | view | raw | blame | history
src/accessmotion.my/shell/shell.go 28 ●●●●● patch | view | raw | blame | history
README.MD
....@@ -13,3 +13,28 @@
1313 ipes user 추가.
1414 root# vi /etc/shells -> /bin/ipes 추가
1515 root# chsh ipes -s /bin/ipes
16
+
17
+
18
+
19
+
20
+
21
+
22
+$root
23
+cp /home/pbsvr/ipes /bin/
24
+chmod 755 /bin/ipes
25
+adduser -p ipes.123 ipes
26
+echo /bin/ipes >> /etc/shells
27
+chsh ipes -s /bin/ipes
28
+
29
+
30
+
31
+10.123.26.117 probing1
32
+10.123.26.120 probing1.1
33
+10.123.28.67 probing2
34
+10.123.161.71 probing3
35
+10.123.161.69 probing4
36
+10.123.151.66 probing5
37
+10.123.151.68 probing6
38
+10.123.26.119 probing1a
39
+10.123.26.121 probing1a.1
40
+10.123.28.69 probing2a
src/accessmotion.my/shell/shell.go
....@@ -94,6 +94,14 @@
9494 }
9595
9696 func Shell() {
97
+
98
+
99
+ /*defer func() {
100
+ s := recover()
101
+ fmt.Println(s)
102
+ }()*/
103
+
104
+
97105 l, err := readline.NewEx(&readline.Config{
98106 Prompt: "IPES-SHELL>> ",
99107 HistoryFile: "/tmp/IPES-SHELL.tmp",
....@@ -309,19 +317,21 @@
309317 fmt.Printf("err %s", err)
310318 }
311319
312
-
313
- var outputs []string = strings.Split(string(out),"\n")
314
-
320
+ var outputs []string = strings.Split(string(out),"\r\n")
315321 i:=0
316
- len := len(outputs)
317
- for i < len -1 {
322
+ length := len(outputs)
323
+ for i < length -1 {
318324 var output []string = strings.Split(string(outputs[i]),",")
319
-
320
- fmt.Printf("%s:%s number:%s ip:%s\n",
321
- strings.TrimSpace(string(output[7])),strings.TrimSpace(string(output[8])),
322
- output[1],strings.TrimSpace(string(output[2])))
325
+ if len(outputs) > 1 {
326
+ log.Printf("%s:%s number:%s ip:%s\n",
327
+ strings.TrimSpace(string(output[6])),strings.TrimSpace(string(output[7])),
328
+ output[1],strings.TrimSpace(string(output[2])))
329
+ i = i + 1
330
+ }
323331 i = i + 1
332
+
324333 }
334
+
325335 }
326336
327337 func setConfig(configName string,valueType string, value string){