Linux Shell Scripting is a series of commands written in plain text files, and text files are called to run a command in it.
Command in linux shell diverse as create / update / delete files or folders sebua, mounting, until able to backup the database.
While Crontab is a scheduling application on linux that allows for automatic execution of programs / applications / scripts with the scheduled time.
So with two Linux capabilities is a complete combination to create a backup database automatically and scheduled.
Below are step by step to make the Auto Backup MySQL Database
1. Create all files, for example auto_backup.sh In that file write linux shell scripting , as below:
v_tgl = `date +% Y% m% d_% H% M% S`;
v_name = bukutamu_ $ v_tgl.sql;
mysqldump-uroot-ppass guestbook> / home / dendie / Desktop / $ v_name;
This script is a scripting shell that do dump / backup of a database named guestbook to address / home / dendie / Desktop /
While the scripts that perform database backup is
mysqldump-uroot-ppass guestbook> / home / dendie / Desktop / $ v_name;
variable $ vname naming format file containing the results shell script that is used as the name of the dump / backup the database.
example of the backup is bukutamu_20100128_203001.sql
While the script that makes a file-naming format is
v_tgl = `date +% Y% m% d_% H% M% S`;
v_name = bukutamu_ $ v_tgl . sql;
2. Set file auto_backup.sh as
execute files sudo chmod + x auto_backup.sh
3. At the command line set Crontab / Scheduling for execution files auto_backup.sh
sudo crontab-e
then typed as below
* / 5 * * * * / home / dendie / Desktop / my_data / auto_backup.sh> / home / dendie / Desktop / auto_backup.log
The above examples make crontab / scheduling for the execution file auto_backup.sh every 5 minutes once and create logs / records to a file auto_backup.log event of trouble during execution.
Command in linux shell diverse as create / update / delete files or folders sebua, mounting, until able to backup the database.
While Crontab is a scheduling application on linux that allows for automatic execution of programs / applications / scripts with the scheduled time.
So with two Linux capabilities is a complete combination to create a backup database automatically and scheduled.
Below are step by step to make the Auto Backup MySQL Database
1. Create all files, for example auto_backup.sh In that file write linux shell scripting , as below:
v_tgl = `date +% Y% m% d_% H% M% S`;
v_name = bukutamu_ $ v_tgl.sql;
mysqldump-uroot-ppass guestbook> / home / dendie / Desktop / $ v_name;
This script is a scripting shell that do dump / backup of a database named guestbook to address / home / dendie / Desktop /
While the scripts that perform database backup is
mysqldump-uroot-ppass guestbook> / home / dendie / Desktop / $ v_name;
variable $ vname naming format file containing the results shell script that is used as the name of the dump / backup the database.
example of the backup is bukutamu_20100128_203001.sql
While the script that makes a file-naming format is
v_tgl = `date +% Y% m% d_% H% M% S`;
v_name = bukutamu_ $ v_tgl . sql;
2. Set file auto_backup.sh as
execute files sudo chmod + x auto_backup.sh
3. At the command line set Crontab / Scheduling for execution files auto_backup.sh
sudo crontab-e
then typed as below
* / 5 * * * * / home / dendie / Desktop / my_data / auto_backup.sh> / home / dendie / Desktop / auto_backup.log
The above examples make crontab / scheduling for the execution file auto_backup.sh every 5 minutes once and create logs / records to a file auto_backup.log event of trouble during execution.
0 comments:
Post a Comment