MV Func db_check()
This commit is contained in:
parent
5d6f5ac760
commit
6d36742007
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user