DB Maint Scripts
External shell script to help maintain the cockatrice database tables.
This commit is contained in:
parent
fb4a7b3274
commit
2b55170110
3 changed files with 16 additions and 0 deletions
6
servatrice/scripts/maint_replays
Normal file
6
servatrice/scripts/maint_replays
Normal 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'
|
7
servatrice/scripts/maint_sessions
Normal file
7
servatrice/scripts/maint_sessions
Normal 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}%\""
|
3
servatrice/scripts/mysql.cnf
Normal file
3
servatrice/scripts/mysql.cnf
Normal file
|
@ -0,0 +1,3 @@
|
|||
[client]
|
||||
user={db_username}
|
||||
password={db_password}
|
Loading…
Reference in a new issue