XenForo Clear IP Logs Cron

Asphyxia

Owner
Administrator
Apr 25, 2015
1,845
2
2,199
327
Here is what you will want to do to clear IP logs from a XenForo install. This tutorial is going to rely on you using an SQL database.
REQUIREMENTS:
1. Have ROOT access to the box (server).
2. Have the database name, username, password for the database connection.

Make a bash script file (SSH in w/ PuTTY or whatever).
Code:
touch ipwiper.sh

Copy the below and edit the user, password and database values to match yours:
Code:
#!/bin/bash

mysql --user=TYPE_USERNAME_HERE --password=TYPE_PASSWORD_HERE --database=TYPE_DATABASE_NAME_HERE --execute="Update xf_ip SET ip = '00'"
Now of course save it in that ipwiper.sh file using either nano or vi!

Throw in the "pwd" command to find the directory your script is stored in. Then copy it, like "/path/to/script", then add "/ipwiper.sh" if that is what you named the bash script.

Go ahead and type "crontab -e" now and you're going to want to place this in. Make adjustments as necessary. This will happen every fifteen minutes:
Code:
*/15 * * * * /path/to/script/ipwiper.sh

In doing some testing, you may want to type just in case:
Code:
chmod u+x ipwiper.sh
 
Last edited:

Supervisor

Administrator
Apr 27, 2015
1,863
2,546
335
Oh please... :rolleyes: No nano installed? o_O x
Good post though, it will keep the IP addresses more safe ;)
 
Last edited:

Asphyxia

Owner
Administrator
Apr 25, 2015
1,845
2
2,199
327
There is nano installed haha, I'm just slightly autistic. I left it up to the individual to use their editor of choice... vi (vim)/nano/gEdit.
 
Top