File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # info: listing system ip
3+
4+ # ----------------------------------------------------------#
5+ # Variable&Function #
6+ # ----------------------------------------------------------#
7+
8+ # Argument defenition
9+ format=" ${1-shell} "
10+
11+ # Importing variables
12+ source $VESTA /conf/vars.conf
13+ source $V_FUNC /shared_func.sh
14+
15+
16+ # ----------------------------------------------------------#
17+ # Action #
18+ # ----------------------------------------------------------#
19+
20+ # Defining functions
21+ conf_shell_list () {
22+ for str in $( cat $V_CONF /vesta.conf) ; do
23+ key=${str%% =* }
24+ value=${str#* =}
25+ echo " $key ${value// \' / } "
26+ done
27+ }
28+
29+ conf_json_list () {
30+ lines=$( wc -l $V_CONF /vesta.conf| cut -f 1 -d ' ' )
31+ i=' 0'
32+ echo -e " {\n\t\" config\" : {"
33+ for str in $( cat $V_CONF /vesta.conf) ; do
34+ i=$(( i + 1 ))
35+ key=${str%% =* }
36+ value=${str#* =}
37+
38+ if [ " $i " -lt " $lines " ]; then
39+ echo -e " \t\t\" $key \" : \" ${value// \' / } \" ,"
40+ else
41+ echo -e " \t\t\" $key \" : \" ${value// \' / } \" "
42+ fi
43+ done
44+ echo -e " \t}\n}"
45+ }
46+
47+
48+ # Listing system config
49+ case $format in
50+ json) conf_json_list ;;
51+ shell) conf_shell_list | column -t ;;
52+ * ) check_args ' 1' " 0" ' [format]'
53+ esac
54+
55+
56+ # ----------------------------------------------------------#
57+ # Vesta #
58+ # ----------------------------------------------------------#
59+
60+ # Logging
61+ log_event ' system' " $V_EVENT "
62+
63+ exit $OK
You can’t perform that action at this time.
0 commit comments