• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[LINUX] Auto server restart AND database backup

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
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!
 
Back
Top