Disable WordPress built-in cron because it's unreliable and suboptimal.
- In
wp-config.php
set:define('DISABLE_WP_CRON', true);
- On server in
$HOME
create the following:~/backups/ # directory to store DB backups in ~/bin/wp # [WP-CLI](https://wp-cli.org/), make it executable ~/bin/wpbackup # see wpbackup.sh below, make it executable ~/bin/wpcron10min # see wpcron10min.sh below, make it executable
- Configure Crontab:
crontab -e
# Run every 10 minutes */10 * * * * $HOME/bin/wpcron10min # Run every 8 hours, 5 minutes past the hour 5 */8 * * * $HOME/bin/wpbackup