Disaster recovery Required
Back up off the machine
Copy backups automatically to storage in another place, which an attacker on the server cannot delete.
How to do it
Use the database's own backup tool on a schedule, such as pg_dump, mysqldump, a snapshot or SQLite VACUUM INTO. Never copy a live database file with plain cp. Encrypt the copy and send it to another provider or region. Use a key that can only add files, and turn on versioning or an object lock, such as S3 Object Lock. An attacker who takes over the server must not be able to delete or change the backups. How long each copy stays is set in backup retention. See encrypted backups and restore tests.
How to check
The newest backup in the off-site store is younger than the recovery point objective, and the server's own keys cannot delete it.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers operations playbook: https://agentwranglers.se/playbook/operations/disaster-recovery/off-site-backups.