<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>General IT &#8211; Everything is Broken</title>
	<atom:link href="https://play.datalude.com/blog/category/it/feed/" rel="self" type="application/rss+xml" />
	<link>https://play.datalude.com/blog</link>
	<description>Efficiency vs. Inefficiency, in a no-holds barred fight.</description>
	<lastBuildDate>Mon, 30 Nov 2026 02:18:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>
	<item>
		<title>Using restic for mysql backups</title>
		<link>https://play.datalude.com/blog/2026/11/using-restic-for-mysql-backups/</link>
					<comments>https://play.datalude.com/blog/2026/11/using-restic-for-mysql-backups/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 30 Nov 2026 02:14:36 +0000</pubDate>
				<category><![CDATA[Bash Script]]></category>
		<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=825</guid>

					<description><![CDATA[I had previously set up a bash script to backup a mysql database. It created daily dumps, gzipped them, and retained 7 daily, 4 weekly and 3 monthly backups via a system of symlinking. That all worked fine for a few years, but I revisited it more recently as we now wanted to keep an ... <a title="Using restic for mysql backups" class="read-more" href="https://play.datalude.com/blog/2026/11/using-restic-for-mysql-backups/" aria-label="Read more about Using restic for mysql backups">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I had previously set up a bash script to backup a mysql database. It created daily dumps, gzipped them, and retained 7 daily, 4 weekly and 3 monthly backups via a system of symlinking. That all worked fine for a few years, but I revisited it more recently as we now wanted to keep an offsite copy of the backups, and that would require encrypting them. The problem is gzip doesn't do encryption, so we needed to explore a few options, so I went through gpg, zip with password, etc, and then came to restic. </p>



<span id="more-825"></span>



<p class="wp-block-paragraph">I've used restic in many other backup scenarios, but I figured it wouldn't be good with database backups. An sql dump file, I reasoned, would have a few tables that had changed, and many that hadn't. So I was thinking that maybe the answer was to loop through the database, dump each table, and then send those to a restic repo. But then I asked my friendly (too friendly) AI and it told me that I had misunderstood how restic does backups, and it actually uses "Content Defined Chunking" to address the exact problem I was facing. Its a bit math-y, but TLDR: go ahead and do a single dump, and content defined chunking will figure out the bits that are the same, and you'll still get a space efficient incremental backup. (And encrypted of course as that was the original aim). </p>



<p class="wp-block-paragraph">Too good to be true? I'd have to test that out.  So I took two consecutive days files and added them to a restic test repo. Wow. The .sql dump file was the same size of course, but the first restic backup was smaller than the gzipped file. And then adding the second, only increased the total data size by 10%. So I re-wrote the script, and now I've been running that for a few days, here are the results. </p>



<p class="wp-block-paragraph"><strong>Before: </strong>Database dump 4.5Gb. Gzipped file ~ 650Mb. Retaining 14 of them costs 9Gb.</p>



<p class="wp-block-paragraph"><strong>After 5 days of running the new script:</strong> Database dump 4.5Gb. Restic backup actual disk size ~750Gb with 5 incremental backups, so maybe around 1Gb for 14 of them? I'll update this post later when the results are in.</p>



<p class="wp-block-paragraph">So looks like we're on for a substantial space saving. In addition, </p>



<ul class="wp-block-list">
<li>the backup now takes half the time, down from 113 sec to 60.</li>



<li>Server load is better during the backup as dumping mysql through gzip seemed quite CPU heavy, whereas dump to plain file in a temporary folder, then let restic compress it seems lighter. </li>



<li>the script is a lot smaller and cleaner, as restic does all the backup rotation for me with restic forget &#8211;prune. </li>



<li>Encrypted, incremental backups achieved. </li>
</ul>



<pre class="wp-block-code"><code>#!/bin/bash

set -Eeuo pipefail

## Configuration

DB_USER="databaser"
DB_HOST="localhost"

DATABASES="mysql database2 database3"

MAX_DAILY_BACKUPS=7
MAX_WEEKLY_BACKUPS=4
MAX_MONTHLY_BACKUPS=3

# Restic configuration
export RESTIC_REPOSITORY="/data/database-backups/"
export RESTIC_PASSWORD="adfadfasdfasdfasdf"

# Directories
LOG_DIR="/data/database-backups/backup-logs"
TEMP_DUMP_DIR="/data/db-backup-temp"

## Initialisation

LOG_FILE="$LOG_DIR/$(date +%F)_dbbackup.log"

# Send stdout and stderr to log
exec >> "$LOG_FILE" 2>&amp;1

# Remove logs older than 30 days
find "$LOG_DIR" -maxdepth 1 -type f -name '*_dbbackup.log' -mtime +30 -delete


# Error handling

send_alert() {
    local MESSAGE="$1"

    # add your mail, webhook etc here. 
}

error_handler() {
    local exit_code=$1
    local line_number=$2
    local failed_command=$3

    # Prevent error handler from triggering itself
    trap - ERR

    MESSAGE="Database backup FAILED on $(hostname). Exit code: $exit_code. Line: $line_number"

    echo
    echo "=========================================="
    echo "ERROR: $MESSAGE"
    echo "Failed command: $failed_command"
    echo "Time: $(date)"
    echo "=========================================="

    send_alert "$MESSAGE"

    exit "$exit_code"
}

trap 'error_handler "$?" "$LINENO" "$BASH_COMMAND"' ERR


# Backup process

SECONDS=0

echo "=========================================="
echo "Starting mysql backup: $(date)"
echo "=========================================="

# Clean up SQL files from previous runs
echo
echo "Removing previous SQL dumps..."

find "$TEMP_DUMP_DIR" -maxdepth 1 -type f -name '*.sql' -print -delete

# Dump databases
for DB in $DATABASES; do

    echo
    echo "Dumping database: $DB at $SECONDS seconds"

    DUMP_FILE="$TEMP_DUMP_DIR/${DB}_$(date +%F).sql"

    mysqldump -h "$DB_HOST" -u "$DB_USER" \
        --single-transaction --quick --routines --events --triggers \
        "$DB" > "$DUMP_FILE"

    echo "Successfully dumped $DB ($(du -h "$DUMP_FILE" | cut -f1))"

    # Give database a break between dumps
    sleep 10

done

# Restic backup and rotate

echo
echo "Adding SQL dumps to restic repository..."

restic backup "$TEMP_DUMP_DIR" \
    --tag mysql \
    --host "$(hostname -f)"
echo
echo "Applying retention policy..."

restic forget \
    --tag mysql \
    --keep-daily "$MAX_DAILY_BACKUPS" \
    --keep-weekly "$MAX_WEEKLY_BACKUPS" \
    --keep-monthly "$MAX_MONTHLY_BACKUPS" \
    --prune

echo
echo "Getting repo stats ..."
restic stats --mode raw-data

echo
echo "=========================================="
echo "Database backup completed successfully."
echo "Duration: $SECONDS seconds"
echo "Finished: $(date)"
echo "=========================================="
</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2026/11/using-restic-for-mysql-backups/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Increasing Linux swapfile with minimal disruption: the swapfile shuffle</title>
		<link>https://play.datalude.com/blog/2026/04/increasing-linux-swapfile-with-minimal-disruption-the-swapfile-shuffle/</link>
					<comments>https://play.datalude.com/blog/2026/04/increasing-linux-swapfile-with-minimal-disruption-the-swapfile-shuffle/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 22 Apr 2026 07:54:06 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=805</guid>

					<description><![CDATA[Had a server which needed a bit more swap, but the current swap was at 100%, and it was marginal whether there was enough RAM to allow me to delete the current 2G swap and replace it with 4G. So I came up with the "swapfile shuffle". All good. Happy server.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Had a server which needed a bit more swap, but the current swap was at 100%, and it was marginal whether there was enough RAM to allow me to delete the current 2G swap and replace it with 4G. So I came up with the "swapfile shuffle". </p>



<pre class="wp-block-code"><code> # Lets see what we've got
swapon --show
NAME      TYPE SIZE USED PRIO
/swapfile file   2G   2G   -2

# Make a new temp swapfile and turn it on.
fallocate -l 2G /swapfile2
chmod 600 /swapfile2
mkswap /swapfile2
swapon /swapfile2

# Check progress
 htop -> 4G of active swap. Memory looks OK. 
 
# Looking good, so now we turn off the original swapfile, resize it and then turn it on
swapoff /swapfile
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

# Check again. 
htop -> Whoo, now have 6Gb swap

# Now can disable the temp swapfile 
swapoff /swapfile2 
rm /swapfile2
</code></pre>



<p class="wp-block-paragraph">All good. Happy server. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2026/04/increasing-linux-swapfile-with-minimal-disruption-the-swapfile-shuffle/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>bash htaccess file management script</title>
		<link>https://play.datalude.com/blog/2025/11/bash-htaccess-file-management-script/</link>
					<comments>https://play.datalude.com/blog/2025/11/bash-htaccess-file-management-script/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 06 Nov 2025 02:23:24 +0000</pubDate>
				<category><![CDATA[Bash Script]]></category>
		<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=780</guid>

					<description><![CDATA[OK, so its not too hard to run htpasswd manually, but if you spend a lot of time in your job doing it, it's nice to have a tool to do it more efficiently. This is a menu driven script, which will make a backup of your file, and suggest a random password, which you ... <a title="bash htaccess file management script" class="read-more" href="https://play.datalude.com/blog/2025/11/bash-htaccess-file-management-script/" aria-label="Read more about bash htaccess file management script">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">OK, so its not too hard to  run htpasswd manually, but if you spend a lot of time in your job doing it, it's nice to have a tool to do it more efficiently. This is a menu driven script, which will make a backup of your file, and suggest a random password, which you can choose to use or not. </p>



<p class="wp-block-paragraph">As always, don't trust everything you read on the internet, and test before you use in anger. </p>



<pre class="wp-block-code"><code>#!/bin/bash

# Configuration
HTACCESS_FILE_DEFAULT="/etc/nginx/htpasswd-developers

# Function to display a list of users
display_users() {
  echo "--- Existing Users ---"
  # Grep for lines that don't start with # and aren't empty
  # Then use cut to show only the username before the colon, and number the lines
  grep -vE '^(#|$)' "$HTACCESS_FILE" | cut -d':' -f1 | cat -n
  echo "----------------------"
}

# Function to perform a backup
backup_file() {
  if &#91; -f "$HTACCESS_FILE" ]; then
    cp "$HTACCESS_FILE" "$HTACCESS_FILE.bak"
    echo "Backup created at $HTACCESS_FILE.bak"
  else
    echo "No .htpasswd file to back up."
  fi
}

# Function to generate a random password
generate_password() {
    tr -cd '&#91;:alnum:]' &lt; /dev/urandom | head -c 12
}

# --- Main Script ---

# Select the .htpasswd file. Suggest the default value, but allow user to type another name
read -p "Enter .htpasswd file (default: $HTACCESS_FILE_DEFAULT): " HTACCESS_FILE
HTACCESS_FILE=${HTACCESS_FILE:-$HTACCESS_FILE_DEFAULT}

# Ensure the file exists, exit if not
if &#91; ! -f "$HTACCESS_FILE" ]; then
  echo "Password file doesn't exist"
  exit 1
fi

# Main menu loop
while true; do
  echo "Do you want to:"
  echo "a) Add a user"
  echo "r) Remove a user"
  echo "u) Update a user's password"
  echo "l) List users"
  echo "q) Quit"
  read -p "Enter your choice: " choice

  case "$choice" in
    a)
      read -p "Enter username to add: " username
      # Check if the username already exists
      if grep -q "^$username:" "$HTACCESS_FILE"; then
        echo "Error: User '$username' already exists. Use the 'u' option to update their password."
      else
        suggested_password=$(generate_password)
        read -p "Enter password for '$username' (or press Enter to use suggested: $suggested_password): " password
        password=${password:-$suggested_password}
        
        backup_file
        htpasswd -b "$HTACCESS_FILE" "$username" "$password"
        echo "User '$username' added."
      fi
      ;;
    r)
      display_users
      read -p "Enter reference number of user to remove: " ref
      # Use grep and sed to find the line number and get the username
      username_to_remove=$(grep -vE '^(#|$)' "$HTACCESS_FILE" | sed -n "${ref}p" | cut -d':' -f1)

      if &#91; -z "$username_to_remove" ]; then
        echo "Invalid reference number."
      else
        backup_file
        # Create a temp file without the user and then replace the original
        grep -v "^$username_to_remove:" "$HTACCESS_FILE" > "$HTACCESS_FILE.tmp" &amp;&amp; mv "$HTACCESS_FILE.tmp" "$HTACCESS_FILE"
        echo "User '$username_to_remove' removed."
      fi
      ;;
    u)
      display_users
      read -p "Enter reference number of user to update: " ref
      username_to_update=$(grep -vE '^(#|$)' "$HTACCESS_FILE" | sed -n "${ref}p" | cut -d':' -f1)

      if &#91; -z "$username_to_update" ]; then
        echo "Invalid reference number."
      else
        suggested_password=$(generate_password)
        read -p "Enter new password for '$username_to_update' (or press Enter to use suggested: $suggested_password): " password
        password=${password:-$suggested_password}

        backup_file
        htpasswd -b "$HTACCESS_FILE" "$username_to_update" "$password"
        echo "Password for user '$username_to_update' updated."
      fi
      ;;
    l)
      display_users
      ;;
    q)
      echo "Exiting."
      exit 0
      ;;
    *)
      echo "Invalid option. Please try again."
      ;;
  esac

  echo ""
done
</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2025/11/bash-htaccess-file-management-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Revert Linux systemd interface naming to simple legacy naming</title>
		<link>https://play.datalude.com/blog/2025/08/revert-linux-systemd-interface-naming-to-simple-legacy-naming/</link>
					<comments>https://play.datalude.com/blog/2025/08/revert-linux-systemd-interface-naming-to-simple-legacy-naming/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 13 Aug 2025 08:13:21 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=749</guid>

					<description><![CDATA[I do understand the reasons for why this change was made, but I simply don't want to have to remember my USB wifi interface's mac address every time I want to reference it, so this is how to turn back to simpler times. Hello eth0 and wlan0. I've missed you. This is just a reminder ... <a title="Revert Linux systemd interface naming to simple legacy naming" class="read-more" href="https://play.datalude.com/blog/2025/08/revert-linux-systemd-interface-naming-to-simple-legacy-naming/" aria-label="Read more about Revert Linux systemd interface naming to simple legacy naming">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I do understand the reasons for why this change was made, but I simply don't want to have to remember my USB wifi interface's mac address every time I want to reference it, so this is how to turn back to simpler times. </p>



<pre class="wp-block-code"><code>sudo nano /etc/default/grub
# Add net.ifnames=0 to the end of your default commandline. eg 

GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash net.ifnames=0"

sudo grub-update
# Check these don't refer to the previous names. 
cat /etc/network/interfaces /etc/network/interfaces.d/*

sudo reboot</code></pre>



<p class="wp-block-paragraph">Hello eth0 and wlan0. I've missed you. <br><br>This is just a reminder for me, so I don't have to look it up again. </p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2025/08/revert-linux-systemd-interface-naming-to-simple-legacy-naming/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Google Gemini bad qdrant systemd advice</title>
		<link>https://play.datalude.com/blog/2025/08/google-gemini-bad-qdrant-systemd-advice/</link>
					<comments>https://play.datalude.com/blog/2025/08/google-gemini-bad-qdrant-systemd-advice/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 06 Aug 2025 02:00:38 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=742</guid>

					<description><![CDATA[Sometimes I give AI a shot. This was one of the occasions where I did, and it ended up costing me more time that actually trying to solve the problem myself. I had a request to run qdrant database, and I didn't want to do it under docker, due to all the extra nonsense that ... <a title="Google Gemini bad qdrant systemd advice" class="read-more" href="https://play.datalude.com/blog/2025/08/google-gemini-bad-qdrant-systemd-advice/" aria-label="Read more about Google Gemini bad qdrant systemd advice">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Sometimes I give AI a shot. This was one of the occasions where I did, and it ended up costing me more time that actually trying to solve the problem myself. </p>



<p class="wp-block-paragraph">I had a request to run qdrant database, and I didn't want to do it under docker, due to all the extra nonsense that entails. So having installed it, basically just dropping a binary on the filesystem, I wanted to run it as a systemd service, under a specific user, qdrant. <br><br>On the qdrant site, they don't give an example, so I thought it would be quickest to ask Google Gemini, which quickly squirted out a reply. So I activated it and was confused when it wouldn't start. About an hour later, I figured out that the inline comments which Gemini had put in the systemd service files are not allowed. And when telling Gemini about this it cheerfully admitted that it knew about this all along:</p>



<figure class="wp-block-image size-full"><a href="https://play.datalude.com/blog/wp-content/uploads/2025/08/googleduh_16-50.jpg"><img fetchpriority="high" decoding="async" width="838" height="712" src="https://play.datalude.com/blog/wp-content/uploads/2025/08/googleduh_16-50.jpg" alt="" class="wp-image-743" srcset="https://play.datalude.com/blog/wp-content/uploads/2025/08/googleduh_16-50.jpg 838w, https://play.datalude.com/blog/wp-content/uploads/2025/08/googleduh_16-50-300x255.jpg 300w, https://play.datalude.com/blog/wp-content/uploads/2025/08/googleduh_16-50-768x653.jpg 768w" sizes="(max-width: 838px) 100vw, 838px" /></a></figure>



<p class="wp-block-paragraph">Even though I 'shared' the finding, I'm skeptical that Gemini will learn from it, so here is the working qdrant systemd file for anyone interested. </p>



<pre class="wp-block-preformatted"><code><code>[Unit]
Description=Qdrant Vector Database
After=network.target

[Service]
# sudo adduser --system --no-create-home --group qdrant
User=qdrant
Group=qdrant

ExecStart=/usr/bin/qdrant --config-path /etc/qdrant/config.yaml

# Put all data in here, please
WorkingDirectory=/qdrant

# Increase open file limit for better performance
LimitNOFILE=65536

Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target</code></code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2025/08/google-gemini-bad-qdrant-systemd-advice/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Error reporting settings in php-fpm not recognized</title>
		<link>https://play.datalude.com/blog/2025/04/error-reporting-settings-in-php-fpm-not-recognized/</link>
					<comments>https://play.datalude.com/blog/2025/04/error-reporting-settings-in-php-fpm-not-recognized/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 21 Apr 2025 05:39:52 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=739</guid>

					<description><![CDATA[I've been frustrated by this one several times. If you run an nginx server with php-fpm you'll be used to setting php values in the php-fpm pool file. That should supercede any values in php.ini So with some values this works: These all work fine. But if you look anywhere on the internet, it tells ... <a title="Error reporting settings in php-fpm not recognized" class="read-more" href="https://play.datalude.com/blog/2025/04/error-reporting-settings-in-php-fpm-not-recognized/" aria-label="Read more about Error reporting settings in php-fpm not recognized">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I've been frustrated by this one several times. If you run an nginx server with php-fpm you'll be used to setting php values in the php-fpm pool file. That should supercede any values in php.ini<br><br>So with some values this works:</p>



<pre class="wp-block-code"><code>;;; php settings
php_flag&#91;display_errors] = off
php_admin_value&#91;error_log] = /home/bobthebuilder/logs/phpfpm.log
php_admin_flag&#91;log_errors] = on
</code></pre>



<p class="wp-block-paragraph">These all work fine. But if you look anywhere on the internet, it tells you you can also set error_logging there. It confidently tells you to use</p>



<pre class="wp-block-code"><code>php_admin_value&#91;error_reporting] = E_ALL &amp; ~E_WARNING &amp; ~E_NOTICE &amp; ~E_DEPRECATED &amp; ~E_USER_DEPRECATED
</code></pre>



<p class="wp-block-paragraph">&#8230;for example. But this doesn't work! You check and re-check the log files which are scrolling past at nausea-inducing rates. You try altering the values in php.ini, wordpress config files, anywhere you can try. But when you load up phpinfo, it just tells you you're wasting your time. You shout at google gemini a bit, but it tells you the same thing. Maybe you have some formatting errors, it suggests?<br><br>The trick, it seems is to use the numeric values. This works in your phpfpm pool file instead of the command above.</p>



<pre class="wp-block-code"><code>php_admin_value&#91;error_reporting] = 8181</code></pre>



<p class="wp-block-paragraph">That's it. And there's a pretty handy page for calculating the masks <a href="https://maximivanov.github.io/php-error-reporting-calculator/">here</a>. <br><br>Now wouldn't it be nice if PHP had pre-set log levels so all you have to do is put error_log_level = 3 instead of invoking a bitmask calculator &#8230;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2025/04/error-reporting-settings-in-php-fpm-not-recognized/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Updraft Backup settings for Hetzner S3 storage</title>
		<link>https://play.datalude.com/blog/2025/02/updraft-backup-settings-for-hetzner-s3-storage/</link>
					<comments>https://play.datalude.com/blog/2025/02/updraft-backup-settings-for-hetzner-s3-storage/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 01 Feb 2025 08:18:20 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=736</guid>

					<description><![CDATA[Just a quick one, as I couldn't find the answer around the internet. That's it. Hit Test, and away you go. Backing up from US to Hetzner Germany took about 20 mins for 1.2Gb backup. Slow, but it completed without error.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Just a quick one, as I couldn't find the answer around the internet. </p>



<ul class="wp-block-list">
<li>In Updraft, chose <strong>S3-Compatible (generic)</strong> storage option</li>



<li><strong>S3 Access key</strong> and <strong>S3 Secret Key</strong> are obvious enough and are as given by Hetzner. Access Key is the smaller of the two. </li>



<li>In <strong>S3 Location</strong>, you just need the bucket name, so that it reads s3generic://mybucketname (i.e. just type mybucketname in the box)</li>



<li>In the <strong>S3 endpoint </strong>box, you want just the domain name of the storage server, eg fsn1.your-objectstorage.com<br></li>
</ul>



<p class="wp-block-paragraph">That's it. Hit Test, and away you go. </p>



<p class="wp-block-paragraph">Backing up from US to Hetzner Germany took about 20 mins for 1.2Gb backup. Slow, but it completed without error. </p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2025/02/updraft-backup-settings-for-hetzner-s3-storage/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mysql 8 mysql_native_password deprecation error. MY-013360</title>
		<link>https://play.datalude.com/blog/2024/02/mysql-8-mysql_native_password-deprecation-error-my-013360/</link>
					<comments>https://play.datalude.com/blog/2024/02/mysql-8-mysql_native_password-deprecation-error-my-013360/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 14 Feb 2024 08:10:10 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[error logs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=731</guid>

					<description><![CDATA[Checking in on a Mysql 8.x server the other day I found the following in the /var/log/mysql/error.log But not just one of them. Lots and lots of them, one a second, for the last few months. To be sure it didn't seem critical, but having lots of crap in your logs means its obscuring the really ... <a title="Mysql 8 mysql_native_password deprecation error. MY-013360" class="read-more" href="https://play.datalude.com/blog/2024/02/mysql-8-mysql_native_password-deprecation-error-my-013360/" aria-label="Read more about Mysql 8 mysql_native_password deprecation error. MY-013360">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Checking in on a Mysql 8.x server the other day I found the following in the /var/log/mysql/error.log </p>



<pre class="wp-block-code"><code>&#91;Warning] &#91;MY-013360] &#91;Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'</code></pre>



<p class="wp-block-paragraph">But not just one of them. Lots and lots of them, one a second, for the last few months. To be sure it didn't seem critical, but having lots of crap in your logs means its obscuring the really important bits, and making it hard to detect real problems. </p>



<p class="wp-block-paragraph">So how to get rid of them? Well not too hard as it happens. First option is to suppress them in your mysql config. I didn't know this was an option, but yes, you can add the following line to your mysqld config file and they don't get logged any more. </p>



<pre class="wp-block-code"><code>log_error_suppression_list='MY-013360'</code></pre>



<span id="more-731"></span>



<p class="wp-block-paragraph">And restart. This can also be set without restarting the server using SET GLOBAL:</p>



<pre class="wp-block-code"><code>mysql> set global log_error_suppression_list='MY-013360' ;<br>Query OK, 0 rows affected (0.00 sec)<br></code></pre>



<p class="wp-block-paragraph">Very useful if you just want to get rid of it while you're troubleshooting something. But now to get down to the root cause. How do we fix the error completely. Again not too hard. First of all we can take a look and see which user is the offender, and the default server policy. </p>



<pre class="wp-block-code"><code>mysql -e " show variables like 'default_authentication_plugin';"<br>  default_authentication_plugin = caching_sha2_password<br><br>mysql -e "select Host,User,plugin FROM  mysql.user;"<br>| Host      | User               | plugin                |<br>| localhost | guilty-user          | mysql_native_password |<br>| localhost | mysql.session    | caching_sha2_password |<br>| localhost | mysql.sys         | caching_sha2_password |<br>| localhost | root               | auth_socket             |<br></code></pre>



<p class="wp-block-paragraph">Well it was guilty-user, what a surprise. So lets fix that. The current password for guilty-user will be known to you &#8212; it'll be in the WP config file, or database connection string of whatever app is using it. Lets say its "F$ntasticPW", so we just ALTER the user using the same password:</p>



<pre class="wp-block-code"><code>mysql -e "ALTER USER 'guilty-user'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'F$ntasticPW';"</code></pre>



<p class="wp-block-paragraph">And there we have it. The app shouldn't even blink. And your monster db logs are gone. But as always, take a db backup before you try. </p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2024/02/mysql-8-mysql_native_password-deprecation-error-my-013360/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nice formatting for mysql show variables / show status</title>
		<link>https://play.datalude.com/blog/2024/02/nice-formatting-for-mysql-show-variables-show-status/</link>
					<comments>https://play.datalude.com/blog/2024/02/nice-formatting-for-mysql-show-variables-show-status/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 12 Feb 2024 08:20:22 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=727</guid>

					<description><![CDATA[Have you ever tried to get a variable out of mysql and your screen fills with dots and dashes from mysql's output? Turns out its pretty simple to get rid of with awk. That's all.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Have you ever tried to get a variable out of mysql and your screen fills with dots and dashes from mysql's output? Turns out its pretty simple to get rid of with awk. </p>



<pre class="wp-block-code"><code># Arrgh!<br>mysql -e "show variables" | grep innodb<br><br># Much better<br>mysql -e "show variables" | awk '{print $1 " = " $2}' | grep innodb</code></pre>



<p class="wp-block-paragraph">That's all. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2024/02/nice-formatting-for-mysql-show-variables-show-status/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Changing default port for grafana agent</title>
		<link>https://play.datalude.com/blog/2024/02/changing-default-port-for-grafana-agent/</link>
					<comments>https://play.datalude.com/blog/2024/02/changing-default-port-for-grafana-agent/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 05 Feb 2024 04:58:09 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://play.datalude.com/blog/?p=724</guid>

					<description><![CDATA[This was much more difficult than it should have been. Grafana agent runs on port 9090 and 9091, so when I installed it on a server where nginx was using those ports, I got an error, not unreasonably. error creating the agent server entrypoint" err="creating HTTP listener: listen tcp 127.0.0.1:9090: bind: address already in use ... <a title="Changing default port for grafana agent" class="read-more" href="https://play.datalude.com/blog/2024/02/changing-default-port-for-grafana-agent/" aria-label="Read more about Changing default port for grafana agent">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This was much more difficult than it should have been. Grafana agent runs on port 9090 and 9091, so when I installed it on a server where nginx was using those ports, I got an error, not unreasonably.<br></p>



<pre class="wp-block-preformatted">error creating the agent server entrypoint" err="creating HTTP listener: listen tcp 127.0.0.1:9090: bind: address already in use</pre>



<p class="wp-block-paragraph">Fair enough. But how to change it? I looked through the /etc/grafana-agent.yaml file but there was nothing in there. I searched the grafana docs and forums. Nothing. I searched google and asked phind for suggestions, which irritatingly told me to make several changes for files and variables that didn't exist. <br><br>I looked for the systemd service file, which wasn't in the normal places /etc/systemd/system or /lib/systemd/system/ but in a further subdir of /etc/systemd/system/multi-user.target.wants/ and /usr/lib/systemd/system/multi-user.target.wants/<br><br>OK, so now a clue. That contained a line EnvironmentFile=/etc/default/grafana-agent, and that's where you need to edit the ports. </p>



<pre class="wp-block-code"><code># Any user defined arguments<br>CUSTOM_ARGS="-server.http.address=127.0.0.1:9090 -server.grpc.address=127.0.0.1:9091"<br></code></pre>



<p class="wp-block-paragraph">So hopefully that will save someone some time, as I wasted an hour on it.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2024/02/changing-default-port-for-grafana-agent/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
