assistanz
Assistanz

Database Automatic backup Shell script

cPanel Server Management by AssitanZ

For 24×7 cPanel Server Management – with Monitoring, Unlimited Tech Support, Disaster Recovery, Security updates and much more Signup today!

Database Automatic Backup Shell Script

Auto backup script for cPanel we can backup our databases using different methods, Here is the shell script used for automatic backup MySQL databases using mysqldump in your cpanel server. The following instruction can be used to backup any database. The only requirement is that you are using a Linux server to host your files and mysql user privileges. Use this Database Automatic backup Shell script  via cron job.

Database Auto Backup Solution 1

Login your cPanel – > Click Cron Job icon

Database Automatic backup Shell script

You can set the time and frequency to backup the database. Under the command field, copy and paste the following command:

mysqldump –opt -Q -u dbusername –password=dbpassword dbname | gzip > /backup/db_backup.sql.gz

Replace dbusername with the database user
Replace dbpassword with the database user password
Replace dbname with the database that you are backing up
Replace the /backup folder to the file path in your server where you want to save the backup

Database Auto Backup Solution 2

AutoMySQLBackup with a basic configuration will create Daily, Weekly and Monthly backups of one or more of your MySQL databases from one or more of your MySQL servers.

Other Features include:
– Email notification of backups
– Backup Compression and Encryption
– Configurable backup rotation
– Incremental database backups
Please make sure you haven’t any corrupted database tables. Because it will not backup properly when you run this script.

How to install Database Automatic backup Shell script

Download automatica mysql database backup script

#cd /usr/local/src/
#wget

http://downloads.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz

#tar -zxvf automysqlbackup-v3.0_rc6.tar.gz

Run the install.sh script.

#./install.sh

Edit the /etc/automysqlbackup/myserver.conf file and remove # to update database user and passwor settings, Backup directory location.

vi /etc/automysqlbackup/automysqlbackup.conf

# Username to access the MySQL server e.g. dbuser
CONFIG_mysql_dump_username='root'
# Password to access the MySQL server e.g. password
CONFIG_mysql_dump_password='password'
# Backup directory location e.g /backups
CONFIG_backup_dir='/var/backup/db'

Run backup script via command line simply by running the following command.

#automysqlbackup /etc/automysqlbackup/automysqlbackup.conf

Done!! You can check DB backup folder.

Automysqlbackup can be run a number of ways, you can choose which is best for you.

1. Create a script as below called runmysqlbackup using the lines below:

vi runmysqlbackup.sh

#!/bin/sh

/usr/local/bin/automysqlbackup /etc/automysqlbackup/automysqlbackup.conf
chown root.root /backup/db* -R
find /backup/db* -type f -exec chmod 400 {} ;
find /backup/db* -type d -exec chmod 700 {} ;

2. Save it to a suitable location or copy it to your /etc/cron.daily folder.

3. Make it executable, i.e. chmod +x /etc/cron.daily/runmysqlbackup

cPanel Server Management



AssistanZ is a pioneer in offering 24×7 cPanel Server Management Service since 2004.

We offer 24×7 cPanel Server Management

  • cPanel Server Management
  • cPanel installation and setup
  • cPanel Server optimization
  • cPanel Server Migration
  • cPanel Server Security and Hardering
  • cPanel Server Monitoring
  • cPanel Server Hack Recovery

and Much more.

Sign up

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support