Originally published at tothenoc.substack.com

Sixty-two nightly folders. Zero archives for two of the sites.

Every night the backup job on one of our hosting servers ran, and every night it finished. Ten sites, a local copy with two days of retention, plus a copy offsite. In July I looked inside the backup folders for two of those sites. Sixty-two nightly folders. Zero archives. Not old ones, not broken ones. Nothing, for about two months.

The other eight sites had three archives each, exactly as configured. That is why nobody looked. The job was not failing, it was failing for two sites out of ten, and the only proof was an absence. Nobody checks for an absence.

What I found first looked like junk: a hundred and one small temporary folders under the backup directory, each with a half-made database dump inside. They were not junk. When the backup fails, the code never reaches the step that moves the result into place, so the staging folder stays behind. Every one of them was a night when the backup died.

The panel log said the same thing, if you read it. Status error, the same two sites, every night, with the message "Backup process killed without reporting any error." That is the parent process telling you its child died. Not why.

The cause was one field. In the hosting panel every site has a field for the system user that owns it. It looks like a label. It is not. The backup code runs its commands as that user and changes file ownership to that user. On the two broken sites the field did not hold a user. It held a private IP address of the server, left there by a migration. A user that does not exist cannot run anything, so the child process died at once.

The sites kept working, because the web server reads its own configuration file, and that one was correct. Only the panel's internal jobs used the broken value. Which also means the next PHP or certificate change made from the panel could have written that IP into the web server config and taken the site down. I did not follow that path step by step, so take it as a likely risk, not a certainty.

And the alert? The panel does send "Automatic backup failed" on every failure. It sends it to the admin address in a small settings file. That file still had the vendor's default placeholder. The alarm worked perfectly, every night, to somebody else's address.

The fix was small. Take the real user from two places that agree, the web server config and the owner of the site's files, and put it back in the field. Create the site's backup folder, which was also missing. That one was real but it was not the cause: with the folder created, the backup still failed until the field was fixed. Point the alert to an address we read.

Then do not trust the row you just changed. Run the backup and look for the file. Two archives on disk, 71 MB and 113 MB. The first real backups those two sites had since the server existed.

Two days later I did what should have come first: a restore test. The archive opened fine. Thousands of files, the site configuration, and an empty databases section. The panel backs up only the databases it knows about, from its own table. After the migration that table had one row. Three of the four sites with a database would have restored as clean, empty installs.

So the database backup no longer depends on the panel. A separate nightly dump lists the databases fresh on every run, because a stale list is exactly the defect we were fixing. It dumps each one, tests the compressed file, and checks the dump's own end marker, because a cut-off dump still passes the compression test. The daily mail now carries tables and bytes per database, not "OK". First run: nine databases, zero failures, table counts identical to production on every one.

The last surprise was that daily mail. Every morning it said "Backup OK", with a size and an object count. It measured the sync to offsite storage, not what was inside. And the sync was a mirror. When the local copies rotated out after two days, the offsite copies were deleted too. Eight days of retention on paper, four in reality. Copy instead of mirror, cleanup by age on the remote side, and the eight days became real.

Three checks I run now on any server I take over:

  • count the archives per site, on disk, not the job status,
  • read the file that says where the failure alert goes,
  • restore one site, for real, with its database.

A backup you have not restored is a hope.

The same case rebuilt on a lab server, with the commands on screen: Your Backups Ran Every Night. They Saved Nothing.

-- Alexandru