StonedReality

Headless client database logging issue

3 posts in this topic

I run 2 headless clients on my server and have just noticed it is filling my db with useless crap.  Any way to disable this?

If not what is the best method to remove all the entries on a scheduled basis?

Thanks

Share this post


Link to post
Share on other sites

A couple hundred of mysql entries won't matter at all, however you can infact clean it up quite easily with a mysql query running on cron.

For example:

DELETE FROM account WHERE name = headlessclient;

You could put this in a PHP script:

<?php
// database connect
$mysqli = new mysqli('localhost', 'USERNAME', 'PASSWORD', 'DATABASE');
if ($mysqli->connect_error) {
    die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}

// check if there are any headlessclient rows
$checkrows = mysqli_query($mysqli, "SELECT * FROM account WHERE name = 'headlessclient'");
if(mysqli_num_rows($checkrows) > 0) {

    // delete the rows
	$query = "DELETE FROM account WHERE name = headlessclient";
	if (!mysqli_query($mysqli, $query)) {
		  die('Error: ' . mysqli_error($mysqli));
	}

	echo "Rows deleted.";
} else {
	echo "No rows found.";
}

?>

Backup first, i haven't tested the above.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.