add db_check() to global config_load()

This commit is contained in:
6543 2019-05-12 00:38:40 +02:00
parent 01086b336c
commit e2c482403b
3 changed files with 5 additions and 12 deletions

View File

@ -67,6 +67,11 @@ function config_load() {
readonly dbuser=$(grep -v '#' $config | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"') readonly dbuser=$(grep -v '#' $config | grep ^dbuser= | sed "s|^dbuser=||g" | tr -d '"')
readonly dbpwd=$(grep -v '#' $config | grep ^dbpwd= | sed "s|^dbpwd=||g" | tr -d '"') readonly dbpwd=$(grep -v '#' $config | grep ^dbpwd= | sed "s|^dbpwd=||g" | tr -d '"')
readonly dbport=$(grep -v '#' $config | grep ^dbpwd= | sed "s|^dbport=||g" | tr -d '"') readonly dbport=$(grep -v '#' $config | grep ^dbpwd= | sed "s|^dbport=||g" | tr -d '"')
#db checks
[ "$(db_check)" == $FALSE ] && {
echo "DB ERROR!!" >&2
exit $ERROR_DBLINK
}


#set moviedir #set moviedir
{ {

View File

@ -65,12 +65,6 @@ fi
exit 1 exit 1
} }


#db checks
[ "$(db_check)" == $FALSE ] && {
echo "DB ERROR!!" >&2
exit $ERROR_DBLINK
}

## functions ## functions
function md5_in_add() { function md5_in_add() {
cat $md5list | while read line; do #for each line in md5 cat $md5list | while read line; do #for each line in md5

View File

@ -40,12 +40,6 @@ config_load
########################### ###########################
function main() { function main() {


#db checks
[ "$(db_check)" == $FALSE ] && {
echo "DB ERROR!!" >&2
exit $ERROR_DBLINK
}

#clean DB from old stuff #clean DB from old stuff
{ {
db_query "DELETE From File WHERE (Size=0 OR Size IS NULL OR MD5='' OR MD5 IS NULL OR Name='') AND (TTSync=$TTSYNC_EXIST OR TTSync=$TTSYNC_BACKUP);" db_query "DELETE From File WHERE (Size=0 OR Size IS NULL OR MD5='' OR MD5 IS NULL OR Name='') AND (TTSync=$TTSYNC_EXIST OR TTSync=$TTSYNC_BACKUP);"