summaryrefslogtreecommitdiffstats
path: root/Services/mariadb/sx/mariadb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'Services/mariadb/sx/mariadb.sh')
-rw-r--r--Services/mariadb/sx/mariadb.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/Services/mariadb/sx/mariadb.sh b/Services/mariadb/sx/mariadb.sh
index af6124b..5b2857d 100644
--- a/Services/mariadb/sx/mariadb.sh
+++ b/Services/mariadb/sx/mariadb.sh
@@ -88,11 +88,11 @@ function update_rootuser {
# Find all sqlfiles in /tmp/ and import then using admin user
function import_sqlfiles {
- local filedir=$1; local p=$MARIADB_ROOTPWD;
+ local filedir=$1; local p=$MARIADB_ROOTPWD; local del=$2;
if [ "$(ls -1 $filedir | wc -l)" -ge "1" ]; then
echo "=> Found SQL files to import ..."
for filename in "$filedir"; do
- import_sqlfile $filename
+ import_sqlfile $filename $del
done;
fi;
return 0
@@ -100,10 +100,14 @@ function import_sqlfiles {
# Find all sqlfiles in /tmp/ and import then using admin user
function import_sqlfile {
- local filename=$1; local p=$MARIADB_ROOTPWD;
+ local filename=$1; local p=$MARIADB_ROOTPWD; local del=$2;
if [ -f "$filename" ]; then
echo "===> Importing sql file : $filename"
mysql -u root -p$p < $filename
+ if [ "$del" = "delete"]; then
+ rm -f $filename
+ echo "====> Deleting $filename after import"
+ fi;
else
echo "====> Could not find sql file $filename. Skip import..."
fi;