#!/bin/bash
#Purpose = Backup of Important Data
#Created on 05-05-2015
#Author = Tuukka Merilainen
#Version 1.0

#START
# Tar credentials
 DATE=`date +%d-%b-%Y`                  # This Command will add date in Backup File Name.
 FILENAME=fullbackup-$DATE.tar.gz       # Here I define Backup file name format.
 SRCDIR=/                               # Location of Important Data Directory (Source of backup).
 DESDIR=/example/please/change          # Destination of backup file.

# Database credentials
 user="root"                            # username for database eg. root
 password="example-password"            # password for database
 db_name="fulldbbackup"                 # name for db backupfile
 backup_path="/example/please/change"   # path where backup is stored

# Dump database into SQL file
 mysqldump --user=$user --events --ignore-table=mysql.event --password=$password --all-databases > $backup_path/$db_name-$DATE.sql

# Make tarball of /
 tar -cpzf $DESDIR/$FILENAME --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=$DESDIR $SRCDIR
#END
