-
Notifications
You must be signed in to change notification settings - Fork 0
/
sts
executable file
·36 lines (32 loc) · 868 Bytes
/
sts
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
#!/bin/bash
set -e
####################################
# Configration #
####################################
pwd="your password+"
# repo clone path
# like /Users/lowking/surgio-traffic-statistics/
stsmjsPath="/Users/lowking/surgio-traffic-statistics"
# your surgio domain
# like: http://<your surgio host>:<port>
domain=""
####################################
# END #
####################################
get() {
export surgioPwd="${pwd}" && export domain="${domain}" && zx ${stsmjsPath}/sts.mjs ${stsmjsPath} $1 $2
}
log() {
path=$1/$2
# cat ${stsmjsPath}/$path/*.log
# ls -tr ${stsmjsPath}/$path/*.log |head -n 10 |xargs cat
find "${stsmjsPath}/$path/" -maxdepth 1 -name "*.log" |sort |tail -n -10 |xargs cat
}
case "$1" in
get | log )
$*
;;
* )
echo "valid commands: get, log" >&2
exit 1
esac