Bruiser

backups

9 posts in this topic

Advertisement

I got a bat script that does it for me, it's launched through BEC at the moment however you can also set it to be run through FireDaemon or general windows services. It looks like this:

@echo off
FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H) 
FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H) 
set fname=database_backup_%v_date%_%v_time%.sql 
echo %v_time% 
echo %fname% 
cd /D "C:\MySQL Server 5.6\bin"
mysqldump -u MYUSERNAME -p DATABASENAME1 --password=MYPASSWORD --result-file="C:\Backups\A2Chernarus\%fname%"
mysqldump -u MYUSERNAME -p DATABASENAME2 --password=MYPASSWORD --result-file="C:\Backups\A3Exile\%fname%"
mysqldump -u MYUSERNAME -p DATABASENAME3 --password=MYPASSWORD --result-file="C:\Backups\A2Panthera\%fname%"
ping 127.0.0.1 -n 5 >NUL
exit

 

  • Like 1

Share this post


Link to post
Share on other sites

If someone needs script for linux just create file named backup including:

mysqldump --opt -uUSER -pPASSWORD exile > $(date +%F_%R).sql
mysql -u USER -pPASSWORD -e 'DELETE FROM player WHERE is_alive = 0 OR account_uid = "SomethingWentWrong" OR account_uid = ""' exile
mysql -u USER -pPASSWORD -e 'DELETE FROM vehicle WHERE damage = 1;' exile
mysql -u USER -pPASSWORD -e 'DELETE FROM container WHERE last_accessed < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY);' exile

It will create the db backup, after that it will remove olf player records, wrecks and old containers :)

To run it on every server restart i use cron (crontab -e command):

0 0,3,6,9,12,15,18,21 * * * cd /home/user/exile/ && ./starter restart #server restart 
0 0,3,6,9,12,15,18,21 * * * cd /home/user/baza/ && ./backup #execution of backup script
* * 1 * * find /home/user/baza/*.sql -mtime +7 -exec rm {} \; #remove 7+days old backups (every 24 hrs)

I also use few php scripts through cron to announce restarts.

Edited by WD-40
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.