LCKB
[Script] Automatic backup bases - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Release Zone (https://lckb.dev/forum/forumdisplay.php?fid=190)
+---- Forum: Episode 2 Releases (https://lckb.dev/forum/forumdisplay.php?fid=186)
+----- Forum: Server Side (https://lckb.dev/forum/forumdisplay.php?fid=143)
+----- Thread: [Script] Automatic backup bases (/showthread.php?tid=1840)



- ☣ WARFACE ☣ - 05-06-2013


In total hello,
In general the purpose of a script such is to do ôðüÿ all bases at:
1) Emergency server shutdown at DOS attacks!
2) At server reset!
3) At full of a server stop Devom!
 
As a whole the script will be useful to much, BUT NOT the Script checked

 

#!/bin/sh

DBHOST=localhost
USER=
PASS=
DBNAME_1=newproject_data
DBNAME_2=newproject_db
DBNAME_3=newproject_db_auth

while :;
do
mysqlcheck -h $DBHOST -u $USER --password=$PASS -s -r $DBNAME_1>>"log/`date +%Y-%m-%d_%H:%M:%S`-sql_newproject_data.log"
mysqlcheck -h $DBHOST -u $USER --password=$PASS -s -r $DBNAME_2>>"log/`date +%Y-%m-%d_%H:%M:%S`-sql_newproject_db.log"
mysqlcheck -h $DBHOST -u $USER --password=$PASS -s -r $DBNAME_3>>"log/`date +%Y-%m-%d_%H:%M:%S`-sql_newproject_db_auth.log"
mysqldump -h $DBHOST -u $USER --password=$PASS $DBNAME_1 | gzip > "backup/`date +%Y-%m-%d_%H:%M:%S`-"$DBNAME"_newproject_data.gz"
mysqldump -h $DBHOST -u $USER --password=$PASS $DBNAME_2 | gzip > "backup/`date +%Y-%m-%d_%H:%M:%S`-"$DBNAME"_newproject_db.gz"
mysqldump -h $DBHOST -u $USER --password=$PASS $DBNAME_3 | gzip > "backup/`date +%Y-%m-%d_%H:%M:%S`-"$DBNAME"_newproject_db_auth.gz"

cd Connector/Connector;
./start;
sleep 5;

cd ../../;
cd Helper/Helper;
./start;
sleep 5;

cd ../../;
cd SubHelper/SubHelper;
./start;
sleep 5;

cd ../../;
cd Messenger/Messenger;
./start;
sleep 5;

cd ../../;
cd GameServer;

cd GameServer1;
./start2;
cd ..;

cd GameServer2;
./start2;
cd ..;

cd GameServer3;
./start2;
cd ..;

cd GameServer4;
./start2;
cd ..;

cd GameServer5;
./start2;

cd ../../;
cd LoginServer/LoginServer;
./start;

[ $? -ne 2 ] && break
sleep 30;
done

 

 

! ! ! IMPORTANT! ! !

In the root folder of the server we create folders with the name log and backup for this purpose to leave information about backup and the arisen mistakes at Tampa.
 
The folder - log = Serves for the reporting about backup
The folder - backup = Serves for preservation backup
 
I hope a script it will be useful to you, from you a magic button like with you there was your Warface



- Douglas Farias - 05-31-2013

dont is more easy make a event in mysql *-* ?




- Creep - 05-31-2013

all we would need is a linux navicat premimum or mysql key.. and iam seariching for it like ages




- Wizatek - 06-01-2013


Why not just use HeidiSQL instead of navicat?

 

And to make a database backup i prefer to make a cronjob, auto backup every xx hours and upload the backup to a external server

 

 

backup.sh

BACKUPFILE=/home/backup/MySQLDB_`date +%Y-%m-%d-%H`.sql.gz
mysqldump -u root -pPASSWORDHERE --databases newproject_auth newproject_db newproject_web | gzip > $BACKUPFILE

export SSHPASS=SSHPASSWORDFROMEXTERNALSERVERHERE

sshpass -e sftp -oBatchMode=no -b - IPADDRESSOFEXTERNALSERVER << !
put $BACKUPFILE
bye
!




- halohalo - 06-01-2013


all we would need is a linux navicat premimum or mysql key.. and iam seariching for it like ages

In my forum we got navicat for Linux + working key for registration^^ If you need, pm




- Canton - 06-01-2013


you can also use "mysqldumper" with cronjob...

 

upload to a ftp-server and sending per email, full automatically...  its very nice^^




- Creep - 06-01-2013


In my forum we got navicat for Linux + working key for registration^^ If you need, pm

PM if u got time i guess your inbox is full so I am unable to send u any massages