## Introduction This document explain how to set up automatic backup in Linux Server for Faveo-Helpdesk ## Create Script **Step1:** Create a new file ``` #touch file_name.sh ``` **Step2:** Open the file using your favourite editor. Here i'm using vim ``` #vi filename.sh ``` **Step3:** Paste the below script in the file ## SCRIPT ``` #!/bin/sh app_directory=" " # e.g db="Database Name" #Enter Database user name here db_user="Database User" db_password="Database Password" db_bkp_directory="Path/to/Database/Directory" files_bkp_directory="Path/to/Faveofiles/Directory" date=`date +%d%m%y%H%M` #Database backup mysqldump -u $db_user -p$db_password $db > $db_bkp_directory/db-bkp-$db-$date.sql #File system backup zip -r $files_bkp_directory/files-bkp-$date.zip $app_directory >> /dev/null 2>&1 #Delete files older than 7 days find $db_bkp_directory/ -mtime +7 -exec rm {} \; find $files_bkp_directory/ -mtime +7 -exec rm {} \; ``` **Step4:** Give permission to the script ``` #chmod +x file_name.sh ``` ## Configure Crontab **Step5:** Set the script in cron to execute daily at your preferred time. Here i’m setting to execute it daily 12:00 am. Open cron tab ``` #crontab -e and add the script with full path to it and time ``` ``` # 0 0 * * * cd /Path/to/script && ./file_name.sh ``` ### Note : Before creating the script fill all the required information in the script such as app directory, Database Name, etc.. ## Windows Backup Tools Below are two tools for backup option in Windows. * [Personal Backup](http://personal-backup.rathlev-home.de/index-e.html) * [Iperius Backup](https://www.iperiusbackup.com) These are two commonly used backup tools for data and database backup. We recommend using efficient tools like [Code Guard](https://store.ladybirdwebhost.com/codeguard.php) for the backup process which will be much easy to configure for non technical users also.