Konsoldan veya cronjob görevi olarak kullanabileceğiniz yedekleme betikleri.
MySQL veritabanını yedeklemek:
#!/bin/bash
MYDATE=$(date +%d-%m-%Y-%I-%M)
wall Lokal veri tabanlari yedeklenmeye baslandi.
mysqldump tankado -u tankado –password=pwdXXX > tankado.sql
tar -zcf tankado.sql.tar.gz tankado.sql
rm -rf tankado.sql
mv tankado.sql.tar.gz /home/okoca/Desktop/Backups/Local-Databases/$MYDATE-tankado.sql.tar.gz
cd /home/okoca/Desktop/Backups/Local-Databases/
chmod 400 $MYDATE-tankado.sql.tar.gzTOTALSIZE=$(du -hs .)
wall <<EOF
Lokal veri tabanlarinin yedeklenmesi tamamlandi.
Local-Databases boyutu $TOTALSIZEEOF
FTP üzerinden dosyayı yerele yedekleme:
#!/bin/bash
MYDATE=$(date +%d-%m-%Y-%I-%M)
wall Fedora uzak veritabanlarini yedeklenmeye basladi.FILENAME=smseml.sql.tar.gz
if [ -e $FILENAME ]
then rm $FILENAME
fi
lftp 208.53.170.26<<EOF
user tankado-web sifreXXX
cd private
get -E $FILENAME
quit 0
EOF
chmod 700 $FILENAME
mv $FILENAME /home/okoca/Desktop/Backups/Remote-Databases/$MYDATE-$FILENAME
chmod 400 /home/okoca/Desktop/Backups/Remote-Databases/$MYDATE-$FILENAMEFILENAME=tankado.sql.tar.gz
if [ -e $FILENAME ]
then rm $FILENAME
fi
lftp 208.53.170.26<<EOF
user tankado-web sifreXXX
cd private
get -E $FILENAME
quit 0
EOF
chmod 700 $FILENAME
mv $FILENAME /home/okoca/Desktop/Backups/Remote-Databases/$MYDATE-$FILENAME
chmod 400 /home/okoca/Desktop/Backups/Remote-Databases/$MYDATE-$FILENAMEcd /home/okoca/Desktop/Backups/Remote-Databases/
PWD=$(pwd)
TOTALSIZE=$(du -hs .)
wall <<EOF
Uzak veritabanlarinin yedeklenmesi tamamlandi.
Remote-Databases boyutu $TOTALSIZEEOF
Uzak web dizinini yerele yedekleme:
wall Fedora uzak siteleri yedeklenmeye basladi.
lftp 208.53.170.26 <<EOF
user tankado-web sifreXXX
cd httpdocs
lcd /home/okoca/Desktop/Backups/Remote-Web/tankado.com
mirror -cs –parallel=5 –loop
quit 0
EOFlftp 208.53.170.26 <<EOF
user smseml_web sifreXXX
cd httpdocs
lcd /home/okoca/Desktop/Backups/Remote-Web/samsunmerkezeml.k12.tr
mirror -cs –parallel=5 –loop
quit 0
EOFlftp 208.53.170.26 <<EOF
user yyl-web sifreXXX
cd httpdocs
lcd /home/okoca/Desktop/Backups/Remote-Web/yyl.k12.tr
mirror -cs –parallel=5 –loop
quit 0
EOFlftp 208.53.170.26 <<EOF
user kaya-web sifreXXX
cd httpdocs
lcd /home/okoca/Desktop/Backups/Remote-Web/kayaelektronik.com
mirror -cs –parallel=5 –loop
quit 0
EOFlftp 208.53.170.26 <<EOF
user dipoll-web sifreXXX
cd httpdocs
lcd /home/okoca/Desktop/Backups/Remote-Web/dipoll.com
mirror -cs –parallel=5 –loop
quit 0
EOFcd /home/okoca/Desktop/Backups/Remote-Web/
TOTALSIZE=$(du -hs .)
wall <<EOF
Uzak sitelerin yedeklenmesi tamamlandi.
Remote-Web boyutu $TOTALSIZEEOF