Last active
August 29, 2015 14:10
-
-
Save erayalakese/7acbeb5e95cb02d0be26 to your computer and use it in GitHub Desktop.
Bir CentOS sunucuda ihtiyaç duyduğum yedekleri alması için bir çırpıda yazdığım bash script
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 | |
# gerekli paketleri kontrol et ve kur | |
if ! rpm -qa | grep -qw tar; then | |
yum -y install tar | |
fi | |
if rpm -qa | grep -qw mysql; then | |
# mysql yüklü, yedekle | |
mysqldump -uroot -p --all-databases > mysqlbackup.sql | |
echo "MySQL YEDEKLEME TAMAM" | |
else | |
echo "MySQL YOK, YEDEKLENMEDI" | |
fi | |
if crontab -l > cron-backup.txt | |
then | |
echo "CRON YEDEK TAMAM" | |
else | |
echo yedeklenemedi | |
fi | |
now="$(date +'%d%m%Y-%H%M%S')" | |
tar -cf YEDEK-$now.tar /var/www/html/ mysqlbackup.sql cron-backup.txt | |
rm -f mysqlbackup.sql cron-backup.txt | |
echo "DOSYA YEDEKLEME TAMAM" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment