Created
November 25, 2011 20:07
-
-
Save semihozkoroglu/1394318 to your computer and use it in GitHub Desktop.
veritabanı yedekleme..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "kullanimi: '<user> <dbname> <dbpass>' " | |
echo "Yedekleme dizini belirtmek istiyorsaniz: '<user> <dbname> <dbpass> <path>' " | |
fi | |
date=$(date +"%d-%m-%Y") | |
if [ $# -eq 4 ]; then | |
file="$4$date-dbbackup.gz" | |
else | |
file="$date-dbbackup.gz" | |
fi | |
user=$1 | |
dbname=$2 | |
pass=$3 | |
mysqldump="$(which mysqldump)" | |
gzip="$(which gzip)" | |
$mysqldump -u$user -p$pass $dbname | $gzip -9 > $file | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment