Script Cleanup

Added the ability to specify custom database name.
Added the ability to specify custom table prefix.
Created sub folders for operating systems.
This commit is contained in:
woogerboy21 2015-07-14 15:05:02 -04:00
parent 8a0fdd2089
commit 44025c667e
14 changed files with 51 additions and 23 deletions

View file

@ -0,0 +1,9 @@
#!/bin/bash
# SCHEDULE WITH CRONTAB TO RUN ON A REGULAR BASIS
DBNAME="servatrice" #set this to the database name used
TABLEPREFIX="cockatrice" #set this to the prefix used for the table names in the database (do not inclue the _)
SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file
NUMBEROFDAYS=10 #set this to the number of days desired
mysql --defaults-file=$SQLCONFFILE -h localhost -e "delete from ""$DBNAME"".""$TABLEPREFIX""_sessions where start_time < DATE_SUB(now(), INTERVAL ""$NUMBEROFDAYS"" DAY)"