Knowledgebase

Backup and Maintenance Scripts Print

  • otherapplicationsscripts, other, backup, database, plugins, woocommerce, restore, cron, resourcelimits, diskspace
  • 0

Automating housekeeping.

WHAT TO AUTOMATE

Database dumps File archives Transferring backups off the server Cleaning temporary files and old logs Checking that something ran

WRITING A BACKUP SCRIPT

Dump the database, archive the files, compress, transfer to remote storage, remove local copies older than a few days.

Run it from cron at a quiet hour.

WHAT MATTERS

Store copies off the server. A backup on the same account is lost in the same event that loses the site. Include a retention policy, or backups fill your quota. Log the outcome somewhere you will see. A silent failure means discovering the problem when you need the backup. Verify the files exist and are a plausible size.

RESOURCE AWARENESS

A large backup consumes CPU and I/O. Run it when traffic is low, and be aware that very large accounts may hit limits.

EXISTING TOOLS

Application-level backup plugins handle this with less effort. Use a script where you need control or where no plugin fits.

TESTING

Restore one. An untested backup is an assumption.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot