Cacti backupγΉγ―γͺγγ
- Details
-
Category: Cacti
-
Created on Monday, 23 February 2015 14:57
-
Hits: 3666
[root@localhost www]# cat backup.sh
#/bin/bash
cd /var/www/
# Remove old backups
find /var/www/backups/* -mtime +5 -exec rm -fr {} \; > /dev/null 2>&1
# Remove old RRAs (usually means the datasource is deleted)
find /var/www/html/rra/* -mtime +2 -exec rm -fr {} \; > /dev/null 2>&1
# Create the filename for the backup
eval `date "+day=%d; month=%m; year=%Y"`
INSTFIL="cacti-backup-$year-$month-$day.tar.gz"
# Dump the MySQL Database
mysqldump -uroot --opt cacti> /var/www/html/cacti-backup.sql
mysqldump -uroot --opt syslog> /var/www/html/syslog.sql
# Gzip the whole folder
tar -Pcpzf /var/www/backups/$INSTFIL /var/www/html/*
# Remove the SQL Dump
#rm -f /var/www/html/cacti-backup.sql
#rm -f /var/www/html/syslog.sql
Add comment