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.gz

TOTALSIZE=$(du -hs .)
wall <<EOF
Lokal veri tabanlarinin yedeklenmesi tamamlandi.
Local-Databases boyutu $TOTALSIZE

EOF

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-$FILENAME

FILENAME=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-$FILENAME

cd /home/okoca/Desktop/Backups/Remote-Databases/
PWD=$(pwd)
TOTALSIZE=$(du -hs .)
wall <<EOF
Uzak veritabanlarinin yedeklenmesi tamamlandi.
Remote-Databases boyutu $TOTALSIZE

EOF

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
EOF

lftp 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
EOF

lftp 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
EOF

lftp 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
EOF

lftp 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
EOF

cd /home/okoca/Desktop/Backups/Remote-Web/
TOTALSIZE=$(du -hs .)
wall <<EOF
Uzak sitelerin yedeklenmesi tamamlandi.
Remote-Web boyutu $TOTALSIZE

EOF

 

CEVAP VER

This site uses Akismet to reduce spam. Learn how your comment data is processed.