Data Backup

Skenario Backup : Database dan aplikasi dibackup setiap hari jam 1.30 dini hari. 

Buat file backup_ake.sh

#!/bin/bash

mysqldump --opt -h localhost -u username -ppassword nama_database | bzip2 -c > $1/nama_database.bak.sql.bz2
rsync -a /var/www/nama_app $2/www
rsync -a $1 $2

Buat entri di cron : 

# m h  dom mon dow   command
30 1 * * 0 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/ahad/

30 1 * * 1 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/senin/

30 1 * * 2 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/selasa/

30 1 * * 3 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/rabu/

30 1 * * 4 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/kamis/

30 1 * * 5 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/jumat/

30 1 * * 6 /home/ketahananpangan/bin/backup_ake.sh /home/backup/tmp/ /home/backup/sabtu/

Referensi

  1. Data backup, https://www.qubit-toolkit.org/wiki/Data_backup
  2. Easy Automated Snapshot-Style Backups with Linux and Rsync, http://www.mikerubel.org/computers/rsync_snapshots/
  3. Newbie: Intro to cron, http://www.unixgeeks.org/security/newbie/unix/cron-1.html
  4. DeltaCopy, Alternatif rsync di Windows, http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp
Comments