Just a simple Bash script to provide a small level of support to your WordPress site, by backing up all WordPress files and database.
The main purpose of this script is to a small level of devops or network administration to WordPress without having the need to install plugins. In our experience, most of the backup solutions for WordPress add unnecessary bloat with slow performance – especially on larger sites.
To use this script follow the below steps:
- Update
lifeboat.sh
by editing the two variables below:
site_file_path
: set this to your source (ie: your WordPress root)backup_file_path
: set this to your destination (where you want to store the backups)
- Upload
lifeboat.sh
to your server:
scp lifeboat.sh root@192.168.1.1:/home/<YOUR-USERNAME>/scripts
- Update permissions
cd /home/<YOUR-USERNAME>/scripts
chmod 760 scripts/lifeboat.sh
- Run the script
./lifeboat.sh
- Optional: Automate the process with a cron job.
crontab -e
MAILTO="webmaster@YOUR-DOMAIN.com"
0 0 */10 * * /home/<YOUR-USERNAME>/lifeboat.sh
#👆 Runs on every 10th day-of-month at midnight.