Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

backup public_html

#!/bin/bash
DATE=$(date +%d-%m-%Y)
BACKUP_DIR="/root/backup/web-backup"

# To create a new directory into backup directory location.
mkdir -p $BACKUP_DIR/$DATE

# take each website backup in separate name, use below format.
tar -zcvpf $BACKUP_DIR/2daygeek-$DATE.tar.gz /home/2daygeek
tar -zcvpf $BACKUP_DIR/mageshm-$DATE.tar.gz /home/mageshm
tar -zcvpf $BACKUP_DIR/dialariyalur-$DATE.tar.gz /home/dialariyalur
tar -zcvpf $BACKUP_DIR/ariyalurlive-$DATE.tar.gz /home/ariyalurlive

# Delete files older than 10 days
find $BACKUP_DIR/* -mtime +10 -exec rm {} ;
Source by www.2daygeek.com #
 
PREVIOUS NEXT
Tagged: #backup
ADD COMMENT
Topic
Name
9+7 =