summaryrefslogtreecommitdiffstats
path: root/Services/mariadb/sx
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2014-12-05 19:19:40 +0100
committerstartxfr <clarue@startx.fr>2014-12-05 19:19:40 +0100
commit33c861af09aa7a8758716b16c12b7085c2c6283a (patch)
treec3b131a34b1d953b69e2b8a78e573296f5e63c89 /Services/mariadb/sx
parentde3cd0a17a285afa0dd783ec11024c992f4aa3ff (diff)
downloadphpmyadmin-33c861af09aa7a8758716b16c12b7085c2c6283a.tar.gz
phpmyadmin-33c861af09aa7a8758716b16c12b7085c2c6283a.tar.bz2
phpmyadmin-33c861af09aa7a8758716b16c12b7085c2c6283a.tar.xz
phpmyadmin-33c861af09aa7a8758716b16c12b7085c2c6283a.zip
fin des modifications sur le template mariadb
Diffstat (limited to 'Services/mariadb/sx')
-rw-r--r--Services/mariadb/sx/mariadb.sh10
-rw-r--r--Services/mariadb/sx/mariadb_run.sh7
2 files changed, 10 insertions, 7 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;
diff --git a/Services/mariadb/sx/mariadb_run.sh b/Services/mariadb/sx/mariadb_run.sh
index 07a4c03..7dcf9b2 100644
--- a/Services/mariadb/sx/mariadb_run.sh
+++ b/Services/mariadb/sx/mariadb_run.sh
@@ -2,7 +2,6 @@
source /sx/mariadb.sh
begin_config
-
## if you wan't to add a new user with database
#create_userdb 'dbuser1' 'password'
## if you wan't to add a new user with database (generated password)
@@ -15,8 +14,8 @@ begin_config
#mysql -u root -p$MARIADB_ROOTPWD -e 'select user, host FROM mysql.user;'
## Execute SQL scripts located into a directory
#import_sqlfiles /tmp/sql/*.sql
-## Execute a single SQL script
-#import_sqlfile /tmp/sql/example.sql
-
+## Execute a single SQL script and delete it
+#import_sqlfile /tmp/sql/example.sql delete
end_config
+
start_daemon \ No newline at end of file