DB Maint Scripts

External shell script to help maintain the cockatrice database tables.
This commit is contained in:
woogerboy21 2014-07-01 13:11:52 -04:00
parent fb4a7b3274
commit 2b55170110
3 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,6 @@
#!/bin/bash
#RUN THIS SCRIPT TO REMOVE ALL COCKATRICE REPLAYS FROM THE DATABASE
#--CAN BE SCHEDULED WITH CRONTAB
mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays'
mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays_access'

View file

@ -0,0 +1,7 @@
#!/bin/bash
#REPLACE THE --date="1 month ago" WITH THE TIME FRAME TO CLEAR UP
#EX: --date="1 day ago" (FOR SINGLE DAY)
#--CAN BE SCHEDULED WITH CRONTAB
DATE=$(date +%Y-%m --date="1 month ago")
mysql --defaults-file=./mysql.cnf -h localhost -e "delete from servatrice.cockatrice_sessions where start_time like \"${DATE}%\""

View file

@ -0,0 +1,3 @@
[client]
user={db_username}
password={db_password}