fin backSQL;debut backapache
This commit is contained in:
31
backsql
Executable file
31
backsql
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
DBUSER=""
|
||||
DBPASSWORD=""
|
||||
CURDate=$(date "+%Y%m%d%H%M")
|
||||
FileName=$CURDate$DBUSER
|
||||
DIR="./"
|
||||
DBHOST="" #--host=
|
||||
if [ $# -gt 0 ] ; then
|
||||
DIR=$1
|
||||
fi
|
||||
if [ ! -d $DIR ]; then
|
||||
mkdir $DIR
|
||||
fi
|
||||
|
||||
echo "Nom d'utilisateur"
|
||||
read DBUSER #--user
|
||||
unset DBPASSWORD #--password=
|
||||
prompt="Mot de passe :"
|
||||
while IFS= read -p "$prompt" -r -s -n 1 char
|
||||
do
|
||||
if [[ $char == $'\0' ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
prompt='*'
|
||||
DBPASSWORD+="$char"
|
||||
done
|
||||
|
||||
|
||||
|
||||
mysqldump --host=$DBHOST --user=$DBUSER --password=$DBPASSWORD --all-databases > "$DIR/$FileName.sql"
|
||||
Reference in New Issue
Block a user