MV Func db_check()

This commit is contained in:
6543 2019-05-11 23:46:28 +02:00
parent 5d6f5ac760
commit 6d36742007
3 changed files with 16 additions and 9 deletions

View File

@ -21,3 +21,13 @@ function file_size() {
echo 0
fi
}

# db_check -> TRUE/FALSE
function db_check() {
db_query "SHOW GRANTS FOR CURRENT_USER();" > /dev/null 2> /dev/null
if [ $? == 0 ]; then
echo $TRUE
else
echo $FALSE
fi
}

View File

@ -71,6 +71,12 @@ function help() {
moviedir=""$(echo $moviedir | sed 's|/$||g')""
[ -z "$moviedir" ] && exit 255 #catch case moviedir="/"

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

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

View File

@ -209,13 +209,4 @@ function db_query() {
echo $@ | mysql $args
}

function db_check() {
db_query "SHOW GRANTS FOR CURRENT_USER();" > /dev/null 2> /dev/null
if [ $? == 0 ]; then
echo $TRUE
else
echo $FALSE
fi
}

main #aufruf der main function (eig. programmstart)