strutZ
Australian OT Member {AKA Beastn}
- Joined
- Nov 16, 2014
- Messages
- 1,391
- Solutions
- 7
- Reaction score
- 550
Hey guys,
Just a basic line of code that will auto restart your server when it shuts down and take a backup of your database and name it what ever the date was that it was taken.
Step 1.
Create a folder where your 'tfs' file is located named 'database_backup'
Step 2.
Create a new text file where your 'tfs' file is located and add the following code CHANGING THE BOLD BITS TO SUIT YOU
Step 3.
in your console, type the following:
Step 4.
Paste the following text CHANGING THE BOLD WITH YOUR DATABASE ACCOUNT DETAILS
Profit!
Just a basic line of code that will auto restart your server when it shuts down and take a backup of your database and name it what ever the date was that it was taken.
Step 1.
Create a folder where your 'tfs' file is located named 'database_backup'
Step 2.
Create a new text file where your 'tfs' file is located and add the following code CHANGING THE BOLD BITS TO SUIT YOU
Code:
while true; do mysqldump DATABASENAME | bzip2 -c > database_backup/backup$(date +%d-%m-%Y).sql.bz2 && ./tfs; done
Step 3.
in your console, type the following:
Code:
nano ~/.my.cnf
Step 4.
Paste the following text CHANGING THE BOLD WITH YOUR DATABASE ACCOUNT DETAILS
Code:
[mysqldump]
user=mysqluser
password=secret
Profit!