Cleanup module

This page explains the cleanup settings in OT Backup in plain language, for both operators and the people configuring the application.

What Cleanup Does

OT Backup can automatically remove old backup data so storage does not grow without limit. Cleanup runs on a schedule and permanently removes data according to the cleanup settings you configure.

When a backup is deleted manually it is first soft deleted — it is marked as obsolete and hidden from the normal views, but is not yet removed from storage. The scheduled cleanup is what eventually removes obsolete data permanently.

Cleanup can work on four different areas, controlled separately. You enable or disable each one by filling in or leaving the related setting empty:

  • Obsolete data
  • Failed backups
  • Upload backups
  • Scheduled backups
flowchart TD
    A[Cleanup job starts] --> B{"Delete obsolete data older than (days) is set?"}
    B -- No --> C{"Manual or scheduled keep/age setting is set?"}
    B -- Yes --> D[Delete obsolete jobs and removed equipment older than cutoff]
    D --> E[Delete failed backup records older than same cutoff]
    E --> C
    C -- Yes --> F[Clean successful upload backups per equipment]
    F --> G[Clean successful scheduled backups per equipment]
    C -- No --> H[Write audit summary]
    G --> H

Important To Know

  • Leaving a cleanup field empty means that rule is turned off
  • 0 is not a valid value
  • Manual and scheduled cleanup rules only apply to successful backups
  • Tagged backups are protected from manual and scheduled cleanup unless you explicitly allow cleanup to include them
  • Cleanup writes an audit log entry for each deleted item
  • In the cleanup summary, DeletedBackups counts only backups that were actually deleted successfully

If a backup deletion fails (for example because the folder is missing or access is denied), OT Backup logs the error and does not increase DeletedBackups for that item.

Area What gets deleted Trigger setting
Obsolete data Obsolete jobs and removed equipment older than cutoff Delete obsolete data older than (days)
Failed backups Failed backup records older than cutoff Delete obsolete data older than (days)
Upload Only backups Successful, non-tagged (unless enabled) upload backups Manual keep/age settings
Scheduled backups Successful, non-tagged (unless enabled) scheduled backups Scheduled keep/age settings

Backup Lifecycle

A backup moves through these states. Cleanup is what permanently removes data once the configured age cutoff is reached:

stateDiagram-v2
 [*] --> Successful
 [*] --> Failed
 Successful --> Obsolete: manual delete (soft delete)
 Obsolete --> Permanently_removed: obsolete cutoff reached
 Failed --> Permanently_removed: obsolete cutoff reached

Obsolete Data and Failed Backups

Both are cleaned up using one setting:

  • Delete obsolete data older than (days)

If this field is empty:

  • Obsolete data cleanup is turned off
  • Failed backups are not automatically deleted

If this field has a value:

  • Obsolete data older than that number of days is permanently deleted
  • Removed equipment older than that same cutoff is also deleted
  • Failed backup records older than that same number of days are also deleted

Obsolete backups have both their files and their record removed. Failed backups only have their record removed — no files are deleted, because a failed backup does not produce backup files.

Manual Backups

Upload backups are backups started by a user or by anything other than the scheduler.

Upload cleanup uses two settings:

  • Upload backups: keep newest (count)
  • Upload backups: delete older than (days)

Behavior:

  • Both fields empty: Upload backup cleanup is turned off
  • Only keep newest (count) filled: OT Backup keeps the newest upload backups for each equipment; older ones are deleted
  • Only delete older than (days) filled: OT Backup deletes upload backups older than that number of days
  • Both fields filled: OT Backup first keeps the newest backups for each equipment, then checks the remaining older backups and deletes only those older than the configured number of days

This means the newest kept backups are protected even if they are older than the age setting.

flowchart LR
    A[All successful upload backups for one equipment] --> B[Sort by created descending]
    B --> C["Apply setting 'Upload backups: keep newest (count)'"]
    C --> D[Candidate set remaining backups]
    D --> E["Apply setting 'Upload backups: delete older than (days)'"]
    E --> F[Delete matching candidates]

Scheduled Backups

Scheduled backups are backups created by the scheduler.

Scheduled cleanup uses two settings:

  • Scheduled backups: keep newest (count)
  • Scheduled backups: delete older than (days)

Behavior:

  • Both fields empty: Scheduled backup cleanup is turned off
  • Only keep newest (count) filled: OT Backup keeps the newest scheduled backups for each equipment; older ones are deleted
  • Only delete older than (days) filled: OT Backup deletes scheduled backups older than that number of days
  • Both fields filled: OT Backup first keeps the newest scheduled backups for each equipment, then checks the remaining older ones and deletes only those older than the configured number of days

Tagged Backups

Tagged backups are normally excluded from manual and scheduled cleanup.

Setting:

  • Include tagged backups in cleanup

If this setting is off:

  • Tagged manual and scheduled backups are not deleted by cleanup

If this setting is on:

  • Tagged manual and scheduled backups can be deleted by cleanup rules

This setting does not affect failed backup cleanup.

Cleanup Schedule

  • Cleanup schedule

This setting defines when the cleanup job runs. Cleanup only removes data when the job runs, so choose a schedule that fits how quickly you want old data removed (for example, nightly).

Examples

Example 1: Keep the newest 3 upload backups

Settings:

  • Upload backups: keep newest (count) = 3
  • Upload backups: delete older than (days) = empty

Result:

  • The 3 newest upload backups are kept for each equipment
  • Older upload backups are deleted

Example 2: Delete scheduled backups older than 30 days

Settings:

  • Scheduled backups: keep newest (count) = empty
  • Scheduled backups: delete older than (days) = 30

Result:

  • Scheduled backups older than 30 days are deleted
  • Newer scheduled backups are kept

Example 3: Keep 5 scheduled backups and also use an age limit

Settings:

  • Scheduled backups: keep newest (count) = 5
  • Scheduled backups: delete older than (days) = 30

Result:

  • The 5 newest scheduled backups are kept
  • Older scheduled backups are checked against the 30-day rule
  • Only older scheduled backups that are more than 30 days old are deleted

Summary

  • Empty means disabled
  • Manual and scheduled cleanup rules only apply to successful backups
  • Manual and scheduled cleanup are separate
  • Count is always applied before age for manual and scheduled backups
  • Failed backups are deleted by age using the same cutoff as obsolete data
  • Tagged backups are protected from manual and scheduled cleanup unless you allow cleanup to include them
  • The cleanup schedule controls when cleanup actually runs
An error has occurred. This app may no longer respond until reloaded. Reload 🗙