Zatarra Posted August 30, 2010 Report Posted August 30, 2010 Va pun si eu un backup script luat dintr-un server. Poate cineva are nevoie de el ;-)Daca avetzi intrebari nu ezitati sa le postati#!/bin/bash## creates backups of essential files#DATA="/home /opt /root "CONFIG="/etc /var/lib /var/named"DATABACKUP="/mnt/drive2/backup/bofh/data"CONFIGBACKUP="/mnt/drive2/backup/bofh/config"DATABASEBACKUP="/mnt/drive2/backup/bofh/database"LIST="/mnt/drive2/backlist_$$.txt"#echo "Starting backup at `date +%Y-%m-%d\ %H:%M:%S`"echo ""set $(date)#if test "$1" = "Mon" ; then # weekly a full backup of all data and config. settings: # echo "Performing Full Data Backup..." tar cfz "/mnt/drive2/backup/bofh/data/data_full_$6-$2-$3.tgz" $DATA echo "Removing incremental data backups..." rm -f /mnt/drive2/backup/bofh/data/data_diff* echo "Removing two week old full backup..." find $DATABACKUP -depth -type f \( -ctime +13 -o -mtime +13 \) -print > $LIST rm -f `cat $LIST` # echo "" echo "Performing Full Config Backup..." tar cfz "/mnt/drive2/backup/bofh/config/config_full_$6-$2-$3.tgz" $CONFIG echo "Removing incremental config backups..." rm -f /mnt/drive2/backup/bofh/config/config_diff* echo "Removing two week old full config backup..." find $CONFIGBACKUP -depth -type f \( -ctime +13 -o -mtime +13 \) -print > $LIST rm -f `cat $LIST`else # incremental backup: # echo "Performing Incremental Data Backup..." find $DATA -depth -type f \( -ctime -1 -o -mtime -1 \) -print > $LIST tar cfzT "/mnt/drive2/backup/bofh/data/data_diff_$6-$2-$3.tgz" "$LIST" rm -f "$LIST" # echo "" echo "Performing Incremental config Backup..." find $CONFIG -depth -type f \( -ctime -1 -o -mtime -1 \) -print > $LIST tar cfzT "/mnt/drive2/backup/bofh/config/config_diff_$6-$2-$3.tgz" "$LIST" rm -f "$LIST"fi##echo ""echo "Done!"echo ""echo "------------------------------------------------------------------------"echo "Finished: `date +%Y-%m-%d\ %H:%M:%S`"echo "------------------------------------------------------------------------"echo ""exit 0 Quote
LegendKiller Posted August 30, 2010 Report Posted August 30, 2010 Thanks, chiar cautam asa ceva. Quote