File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # info: changing sysconfig value
3+
4+ # ----------------------------------------------------------#
5+ # Variable&Function #
6+ # ----------------------------------------------------------#
7+
8+ # Argument defenition
9+ key=$( echo " $1 " | tr ' [:lower:]' ' [:upper:]' )
10+ value=${2// /% spc% }
11+
12+ # Importing variables
13+ source $VESTA /conf/vars.conf
14+ source $V_FUNC /shared.func
15+
16+
17+ # ----------------------------------------------------------#
18+ # Verifications #
19+ # ----------------------------------------------------------#
20+
21+ # Checking args
22+ check_args ' 2' " $# " ' key value'
23+
24+ # Checking argument format
25+ format_validation ' key'
26+
27+ # Checking key existance
28+ check_ckey=$( grep " ^$key ='" $V_CONF /vesta.conf)
29+ if [ -z " $check_ckey " ]; then
30+ echo " Error: key not found"
31+ log_event ' debug' " $E_KEY_INVALID $V_EVENT "
32+ exit $E_KEY_INVALID
33+ fi
34+
35+
36+ # ----------------------------------------------------------#
37+ # Action #
38+ # ----------------------------------------------------------#
39+
40+ # Updating conf
41+ sed -i " s/$key =.*/$key ='$value '/g" /tmp/vesta.conf
42+
43+
44+ # ----------------------------------------------------------#
45+ # Vesta #
46+ # ----------------------------------------------------------#
47+
48+ # Logging
49+ log_event ' system' " $V_EVENT "
50+
51+ exit
You can’t perform that action at this time.
0 commit comments