<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.rabbibob.com/index.php?action=history&amp;feed=atom&amp;title=Backing_Up_Mediawiki</id>
	<title>Backing Up Mediawiki - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.rabbibob.com/index.php?action=history&amp;feed=atom&amp;title=Backing_Up_Mediawiki"/>
	<link rel="alternate" type="text/html" href="https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;action=history"/>
	<updated>2026-10-01T00:59:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;diff=2013&amp;oldid=prev</id>
		<title>Rabbi Bob at 19:43, 15 August 2026</title>
		<link rel="alternate" type="text/html" href="https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;diff=2013&amp;oldid=prev"/>
		<updated>2026-08-15T19:43:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:43, 15 August 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I typically run backups in a Weekly \ Monthly \ Annual mode (ongoing) approach so that at the start of the new year, I&amp;#039;ve got 65 backups of the web directories and the databases shuttled off to another server.  The weekly\monthly overwrite as the year progresses, but the annual is there for all time.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I typically run backups in a Weekly \ Monthly \ Annual mode (ongoing) approach so that at the start of the new year, I&amp;#039;ve got 65 backups of the web directories and the databases shuttled off to another server.  The weekly\monthly overwrite as the year progresses, but the annual is there for all time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Below is the basis for my Weekly script.&amp;lt;syntaxhighlight lang=&quot;bash&quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Below is the basis for my Weekly script.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&quot;bash&quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ==============================================================================&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ==============================================================================&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mw_rabbibob_143-wiki_:diff:1.41:old-2012:rev-2013:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Rabbi Bob</name></author>
	</entry>
	<entry>
		<id>https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;diff=2012&amp;oldid=prev</id>
		<title>Rabbi Bob at 19:09, 15 August 2026</title>
		<link rel="alternate" type="text/html" href="https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;diff=2012&amp;oldid=prev"/>
		<updated>2026-08-15T19:09:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:09, 15 August 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&quot;bash&quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;I typically run backups in a Weekly \ Monthly \ Annual mode (ongoing) approach so that at the start of the new year, I&#039;ve got 65 backups of the web directories and the databases shuttled off to another server.  The weekly\monthly overwrite as the year progresses, but the annual is there for all time.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Below is the basis for my Weekly script.&lt;/ins&gt;&amp;lt;syntaxhighlight lang=&quot;bash&quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ==============================================================================&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# ==============================================================================&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mw_rabbibob_143-wiki_:diff:1.41:old-2005:rev-2012:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Rabbi Bob</name></author>
	</entry>
	<entry>
		<id>https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;diff=2005&amp;oldid=prev</id>
		<title>Rabbi Bob: Created page with &quot;&lt;syntaxhighlight lang=&quot;bash&quot; line&gt; #!/bin/bash # ============================================================================== # Weekly LAMP Backup Script # ==============================================================================  # #### Configuration Variables #### SERVER_NAME=&quot;MyServer2026&quot; PERIOD_TYPE=&quot;Weekly&quot; # %V gives the ISO week number (01-53), resetting each year PERIOD_COUNTER=$(date +%V) BUNDLE_NAME=&quot;${SERVER_NAME}_${PERIOD_TYPE}-${PERIOD_COUNTER}.tar.g...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.rabbibob.com/index.php?title=Backing_Up_Mediawiki&amp;diff=2005&amp;oldid=prev"/>
		<updated>2026-08-15T18:57:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt; #!/bin/bash # ============================================================================== # Weekly LAMP Backup Script # ==============================================================================  # #### Configuration Variables #### SERVER_NAME=&amp;quot;MyServer2026&amp;quot; PERIOD_TYPE=&amp;quot;Weekly&amp;quot; # %V gives the ISO week number (01-53), resetting each year PERIOD_COUNTER=$(date +%V) BUNDLE_NAME=&amp;quot;${SERVER_NAME}_${PERIOD_TYPE}-${PERIOD_COUNTER}.tar.g...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ==============================================================================&lt;br /&gt;
# Weekly LAMP Backup Script&lt;br /&gt;
# ==============================================================================&lt;br /&gt;
&lt;br /&gt;
# #### Configuration Variables ####&lt;br /&gt;
SERVER_NAME=&amp;quot;MyServer2026&amp;quot;&lt;br /&gt;
PERIOD_TYPE=&amp;quot;Weekly&amp;quot;&lt;br /&gt;
# %V gives the ISO week number (01-53), resetting each year&lt;br /&gt;
PERIOD_COUNTER=$(date +%V)&lt;br /&gt;
BUNDLE_NAME=&amp;quot;${SERVER_NAME}_${PERIOD_TYPE}-${PERIOD_COUNTER}.tar.gz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
STAGING_DIR=&amp;quot;/home/somedirectory/backups&amp;quot;&lt;br /&gt;
LOG_FILE=&amp;quot;/home/somedirectory/scripts/BackupSync-$(date +%Y).log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# User Provided Lists&lt;br /&gt;
WEB_ROOT=&amp;quot;/var/www/html&amp;quot;&lt;br /&gt;
WEB_DIRS_FILE=&amp;quot;/home/somedirectory/scripts/web_dirs.txt&amp;quot;&lt;br /&gt;
DATABASES_FILE=&amp;quot;/home/somedirectory/scripts/databases.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mapfile -t WEB_DIRS &amp;lt; &amp;lt;(grep -vE &amp;#039;^\s*#|^\s*$&amp;#039; &amp;quot;$WEB_DIRS_FILE&amp;quot;)&lt;br /&gt;
mapfile -t DATABASES &amp;lt; &amp;lt;(grep -vE &amp;#039;^\s*#|^\s*$&amp;#039; &amp;quot;$DATABASES_FILE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Database Credentials&lt;br /&gt;
MYSQL_USER=&amp;quot;dbBackup&amp;quot;&lt;br /&gt;
MYSQL_PASS_FILE=&amp;quot;/home/somedirectory/.backupCredsMySQL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# QNAP NAS Configuration&lt;br /&gt;
QNAP_IP=&amp;quot;192.168.123.123&amp;quot;&lt;br /&gt;
QNAP_USER=&amp;quot;BackupUser&amp;quot;&lt;br /&gt;
QNAP_PASS_FILE=&amp;quot;/home/somedirectory/.qnapUpload&amp;quot;&lt;br /&gt;
QNAP_DEST_DIR=&amp;quot;/share/Public/WebserverBackups/MyServer2026/Weekly&amp;quot;     # Adjust to your actual QNAP share path&lt;br /&gt;
&lt;br /&gt;
# #### Functions ####&lt;br /&gt;
log_event() {&lt;br /&gt;
    # Standard log format: YYYY-MM-DD HH:MM:SS - Message&lt;br /&gt;
    echo &amp;quot;$(date &amp;#039;+%Y-%m-%d %H:%M:%S&amp;#039;) - $1&amp;quot; | tee -a &amp;quot;$LOG_FILE&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# #### Pre-flight Checks ####&lt;br /&gt;
# 1. Staging Directory Check&lt;br /&gt;
if [ ! -d &amp;quot;$STAGING_DIR&amp;quot; ]; then&lt;br /&gt;
    mkdir -p &amp;quot;$STAGING_DIR&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ ! -w &amp;quot;$STAGING_DIR&amp;quot; ]; then&lt;br /&gt;
    echo &amp;quot;$(date &amp;#039;+%Y-%m-%d %H:%M:%S&amp;#039;) - CRITICAL: Staging directory $STAGING_DIR is unavailable or not writable! Exiting.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# 2. QNAP Password File Check&lt;br /&gt;
if [ ! -f &amp;quot;$QNAP_PASS_FILE&amp;quot; ]; then&lt;br /&gt;
    log_event &amp;quot;CRITICAL: sshpass file $QNAP_PASS_FILE not found! Exiting.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# 3. MySQL Password File Check&lt;br /&gt;
if [ ! -f &amp;quot;$MYSQL_PASS_FILE&amp;quot; ]; then&lt;br /&gt;
    log_event &amp;quot;CRITICAL: MySQL password file $MYSQL_PASS_FILE not found! Exiting.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
# 4. List Files Check&lt;br /&gt;
if [ ! -f &amp;quot;$WEB_DIRS_FILE&amp;quot; ]; then&lt;br /&gt;
    log_event &amp;quot;CRITICAL: Web directory list file $WEB_DIRS_FILE not found! Exiting.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ ! -f &amp;quot;$DATABASES_FILE&amp;quot; ]; then&lt;br /&gt;
    log_event &amp;quot;CRITICAL: Database list file $DATABASES_FILE not found! Exiting.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
log_event &amp;quot;=== Starting $PERIOD_TYPE Backup sequence ===&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# #### 1. MySQL Database Exports ####&lt;br /&gt;
log_event &amp;quot;Starting MySQL exports...&amp;quot;&lt;br /&gt;
for db in &amp;quot;${DATABASES[@]}&amp;quot;; do&lt;br /&gt;
    log_event &amp;quot;Exporting database: $db&amp;quot;&lt;br /&gt;
    if mysqldump -u &amp;quot;$MYSQL_USER&amp;quot; -p&amp;quot;$(cat &amp;quot;$MYSQL_PASS_FILE&amp;quot;)&amp;quot; &amp;quot;$db&amp;quot; &amp;gt; &amp;quot;$STAGING_DIR/${db}.sql&amp;quot;; then&lt;br /&gt;
        log_event &amp;quot;Successfully exported $db&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        log_event &amp;quot;ERROR: Failed to export $db&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# #### 2. Web Directories Archiving ####&lt;br /&gt;
log_event &amp;quot;Starting Web Directory compression...&amp;quot;&lt;br /&gt;
for dir in &amp;quot;${WEB_DIRS[@]}&amp;quot;; do&lt;br /&gt;
    if [ -d &amp;quot;$WEB_ROOT/$dir&amp;quot; ]; then&lt;br /&gt;
        log_event &amp;quot;Compressing directory: $dir&amp;quot;&lt;br /&gt;
        # Added _web suffix to distinguish intermediate archives from the master bundle&lt;br /&gt;
        if tar -czf &amp;quot;$STAGING_DIR/${dir}_web.tar.gz&amp;quot; -C &amp;quot;$WEB_ROOT&amp;quot; &amp;quot;$dir&amp;quot;; then&lt;br /&gt;
            log_event &amp;quot;Successfully compressed $dir&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            log_event &amp;quot;ERROR: Failed to compress $dir.&amp;quot;&lt;br /&gt;
        fi&lt;br /&gt;
    else&lt;br /&gt;
        log_event &amp;quot;WARNING: Directory $WEB_ROOT/$dir does not exist. Skipping.&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# #### 3. Final Bundling ####&lt;br /&gt;
log_event &amp;quot;Bundling files into $BUNDLE_NAME...&amp;quot;&lt;br /&gt;
cd &amp;quot;$STAGING_DIR&amp;quot; || exit 1&lt;br /&gt;
&lt;br /&gt;
# Exclude the destination bundle and specifically target intermediate files&lt;br /&gt;
if tar --exclude=&amp;quot;$BUNDLE_NAME&amp;quot; -czf &amp;quot;$BUNDLE_NAME&amp;quot; *.sql *_web.tar.gz; then&lt;br /&gt;
    log_event &amp;quot;Successfully created master bundle: $BUNDLE_NAME.&amp;quot;&lt;br /&gt;
    # Clean up intermediate files&lt;br /&gt;
    rm -f *.sql *_web.tar.gz&lt;br /&gt;
else&lt;br /&gt;
    log_event &amp;quot;CRITICAL: Failed to create master bundle! Exiting.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# #### 4. Rsync to QNAP ####&lt;br /&gt;
log_event &amp;quot;Initiating rsync transfer to QNAP NAS ($QNAP_IP)...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if sshpass -f &amp;quot;$QNAP_PASS_FILE&amp;quot; rsync -avz -e &amp;quot;ssh -o StrictHostKeyChecking=no&amp;quot; &amp;quot;$STAGING_DIR/$BUNDLE_NAME&amp;quot; &amp;quot;${QNAP_USER}@${QNAP_IP}:${QNAP_DEST_DIR}/&amp;quot;; then&lt;br /&gt;
    log_event &amp;quot;SUCCESS: Transfer of $BUNDLE_NAME to QNAP completed.&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    # #### 5. Cleanup ####&lt;br /&gt;
    log_event &amp;quot;Performing local cleanup...&amp;quot;&lt;br /&gt;
    rm -f &amp;quot;$STAGING_DIR/$BUNDLE_NAME&amp;quot;&lt;br /&gt;
    log_event &amp;quot;Removed local copy of $BUNDLE_NAME to conserve disk space.&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
    log_event &amp;quot;ERROR: Rsync transfer failed! Leaving $BUNDLE_NAME in staging area for manual review.&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
log_event &amp;quot;=== $PERIOD_TYPE Backup sequence finished ===&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Weblog-2026-08]]&lt;br /&gt;
[[Category:Backups]]&lt;br /&gt;
[[Category:Webserver]]&lt;/div&gt;</summary>
		<author><name>Rabbi Bob</name></author>
	</entry>
</feed>