Commit 5bdadb10 by sn

mysqlExport praefix

1 parent 075150c0
Showing with 12 additions and 5 deletions
......@@ -11,11 +11,12 @@
execute=1
logfile="$__PATH_to_Log/ncExportMysql.$1.log"
mc_e "$0 !database! dbuser dbpasswd"
mc_e "$0 $1 $2 $3 (logfile=$logfile)"
mc_e "$0 !database! dbuser dbpasswd filepreafix"
mc_e "$0 $1 $2 $3 $4 (logfile=$logfile)"
mc_parameter "1" "1" "$1" "mysql Datenbank (muss vorhanden sein)"
mc_parameter "2" "0" "$2" "Datenbankbenutzer (default root)"
mc_parameter "3" "0" "$3" "Datenbankpasswort "
mc_parameter "4" "0" "$4" "Datei Praefix "
......@@ -31,9 +32,14 @@ if [ -z $3 ] ; then
password=" --password=$3 "
fi
if [ -z $4 ] ; then
praefix='db'
else
praefix="$4.db"
fi
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 "tar -czf $BACKUPFILE.tar.gz $BACKUPFILE" $execute $logfile
......
......@@ -7,7 +7,8 @@
mc_log() {
# echo -e $0 $1 $2
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
echo -e "bitte \"touch $2\" ausführen"
fi
......@@ -47,7 +48,7 @@ mc_bashsu() {
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!