MV Global-Config-Load to #load config (DB,...)()

This commit is contained in:
6543 2019-05-11 23:59:47 +02:00
parent 645a61c521
commit 45135bf695
3 changed files with 17 additions and 11 deletions

View File

@ -43,3 +43,13 @@ function db_query() {
[ $DEBUG == $TRUE ] && echo $@ >&2
echo $@ | mysql $args
}

# config_load()
function config_load() {
#load db settings
readonly dbname=$(grep -v '#' $globalconf | grep ^dbname= | sed "s|^dbname=||g" | tr -d '"')
readonly dbhost=$(grep -v '#' $globalconf | grep ^dbhost= | sed "s|^dbhost=||g" | tr -d '"')
readonly dbuser=$(grep -v '#' $globalconf | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
readonly dbpwd=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbpwd=||g" | tr -d '"')
readonly dbport=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbport=||g" | tr -d '"')
}

View File

@ -31,11 +31,9 @@ fi
readonly md5list="$2"
moviedir="$3"

#db
dbname=$(grep -v '#' $globalconf | grep ^dbname= | sed "s|^dbname=||g" | tr -d '"')
dbhost=$(grep -v '#' $globalconf | grep ^dbhost= | sed "s|^dbhost=||g" | tr -d '"')
dbuser=$(grep -v '#' $globalconf | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
dbpwd=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbpwd=||g" | tr -d '"')
#load config (DB,...)
config_load

}

function help() {

View File

@ -10,7 +10,7 @@
if [ -f "$(readlink -f "$(dirname $0)/bash-lib")" ]; then
source "$(readlink -f "$(dirname $0)/bash-lib")"
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER" >&2
elif [ -f "<LIBDIR>/bash-lib" ]; then #<LIBDIR>
elif [ -f "<LIBDIR>/bash-lib" ]; then
source "<LIBDIR>/bash-lib"
[ $DEBUG == $TRUE ] && echo "LIB VERSION: $LIBVER" >&2
else
@ -34,11 +34,9 @@ fi
[ -z "$moviedir" ] && exit 255 #catch case moviedir="/"
readonly DATE=$(date '+%Y-%m-%d')

#db
dbname=$(grep -v '#' $globalconf | grep ^dbname= | sed "s|^dbname=||g" | tr -d '"')
dbhost=$(grep -v '#' $globalconf | grep ^dbhost= | sed "s|^dbhost=||g" | tr -d '"')
dbuser=$(grep -v '#' $globalconf | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
dbpwd=$(grep -v '#' $globalconf | grep ^dbpwd= | sed "s|^dbpwd=||g" | tr -d '"')
#load config (DB,...)
config_load

}

function help() {