Commit 5bdadb10 by sn

mysqlExport praefix

1 parent 075150c0
Showing with 15 additions and 8 deletions
...@@ -11,11 +11,12 @@ ...@@ -11,11 +11,12 @@
execute=1 execute=1
logfile="$__PATH_to_Log/ncExportMysql.$1.log" logfile="$__PATH_to_Log/ncExportMysql.$1.log"
mc_e "$0 !database! dbuser dbpasswd" mc_e "$0 !database! dbuser dbpasswd filepreafix"
mc_e "$0 $1 $2 $3 (logfile=$logfile)" mc_e "$0 $1 $2 $3 $4 (logfile=$logfile)"
mc_parameter "1" "1" "$1" "mysql Datenbank (muss vorhanden sein)" mc_parameter "1" "1" "$1" "mysql Datenbank (muss vorhanden sein)"
mc_parameter "2" "0" "$2" "Datenbankbenutzer (default root)" mc_parameter "2" "0" "$2" "Datenbankbenutzer (default root)"
mc_parameter "3" "0" "$3" "Datenbankpasswort " mc_parameter "3" "0" "$3" "Datenbankpasswort "
mc_parameter "4" "0" "$4" "Datei Praefix "
...@@ -26,14 +27,19 @@ if [ -z $2 ] ; then ...@@ -26,14 +27,19 @@ if [ -z $2 ] ; then
fi fi
if [ -z $3 ] ; then if [ -z $3 ] ; then
password=' -p ' password=' -p '
else else
password=" --password=$3 " password=" --password=$3 "
fi fi
if [ -z $4 ] ; then
praefix='db'
else
praefix="$4.db"
fi
DATETIME=$(date +"%Y%m%d_%H%M%S") DATETIME=$(date +"%Y%m%d_%H%M%S")
BACKUPFILE="mysql.$1.$DATETIME.sql" BACKUPFILE="$praefix.$1.$DATETIME.sql"
mc_bashsu "mysqldump --single-transaction --default-character-set=utf8 -u $user $password $1 > $BACKUPFILE " $execute $logfile mc_bashsu "mysqldump --single-transaction --default-character-set=utf8 -u $user $password $1 > $BACKUPFILE " $execute $logfile
mc_bashsu "tar -czf $BACKUPFILE.tar.gz $BACKUPFILE" $execute $logfile mc_bashsu "tar -czf $BACKUPFILE.tar.gz $BACKUPFILE" $execute $logfile
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
mc_log() { mc_log() {
# echo -e $0 $1 $2 # echo -e $0 $1 $2
if [ -w $2 ] ; then if [ -w $2 ] ; then
echo "$(date +"%Y%m%d_%H%M%S") $1" >> $2 datetime=$(date +"%Y%m%d_%H%M%S")
echo "$datetime $1" 1>> $2 2>> $2.erro
else else
echo -e "bitte \"touch $2\" ausführen" echo -e "bitte \"touch $2\" ausführen"
fi fi
...@@ -47,7 +48,7 @@ mc_bashsu() { ...@@ -47,7 +48,7 @@ mc_bashsu() {
fi fi
fi fi
mc_log "$1" "$3" # mc_log "$1" "$3"
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!