Time for action – enhancing the backup script

  1. Open the backupCacti.sh script and add the following line between the FILENAME and BACKUPDIR line:
    TGZFILENAME="cacti_files_$DATE.tgz";
    
  2. Add the following two lines at the end of the script:
    # Create the Cacti files backup
    tar -czpf $BACKUPDIR$TGZFILENAME ./etc/cron.d/cacti ./etc/php.ini ./etc/php.d ./etc/httpd/conf ./etc/httpd/conf.d ./etc/spine.conf ./usr/local/spine ./var/www/html/cacti ./var/www/html/cacti-0.8.7g
    
  3. Remove any earlier backups from the backup directory:
    rm /backup/cacti_*
    
  4. Start the backup script:
    /bin/bash /backup/backupCacti.sh
    
  5. Verify whether the database and the files backup have been created:
    ls –l /backup
    

What just happened?

You have enhanced the script to also create a backup ...

Get Cacti 0.8 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.