WPBackupViaGit is for creating a backup point from the website on a git account with any frequency and restoring to any backup point, such as WordPress, etc.
- Backup from databases
- Backup from files and dirs
- Sync backup/restore point with git account
- See all backup/restore points
- Restore to backup/restore point from the git account
- common use is for WordPress but it could be able for any other things that need a backup/restore process
- Create a repository on git for WordPress, website, etc
- Connect to the shell via SSH, cpanel terminal, etc
- Clone your git repository
- for example
git clone "your_repo_url"
- for example
- run
git clone https://github.com/arminmokri/WPBackupViaGit.git
- run
cd WPBackupViaGit
- Copy WPBackupViaGit files to your repository directory
- for example
cp Backup.sh Restore.sh Backup.config database_backup.sh database_restore.sh ../your_repo_dir
- for example
- run
cd ..
- Open Backup.config file in vim or nano or vi or etc
- for example
vi your_repo_dir/Backup.config
- for example
- Fill your data with the structure of examples
- At last set a cron job with any period (hourly, daily, weekly) for your backup process and call Backup.sh script file
- for example
/absolute_path/your_repo_dir/Backup.sh &> /absolute_path/your_repo_dir/Backup.log
- for example
- Clone your git repository
- for example
git clone "your_repo_url"
- for example
- run
./your_repo_dir/Restore.sh --action show-restore-points
to see backup/restore points- as a result, you will see this
fetch restore points from git repo 'your_repo_name' successfully completed.
Index Date Time Commit ID Commit Message
1) 2023-12-09 03:00:03 d36d58ced5a6d9ad3f63557eb2b5554179cc087c backup point 2023/12/09 03:00:06
2) 2023-12-08 03:00:02 c5e54499c78d3794e4fa26b68d2db8bd62cfc0b2 backup point 2023/12/08 03:00:05
...
- find your backup/restore point from the list.
- for restoration we have some commands that I make examples and explanation
- restore to the lastest commit
./your_repo_dir/Restore.sh --action restore --latest
- restore based on the commit id
./your_repo_dir/Restore.sh --action restore --restore-point-type commit-id --restore-point c5e54499c78d3794e4fa26b68d2db8bd62cfc0b2
- restore based on the row index
./your_repo_dir/Restore.sh --action restore --restore-point-type index --restore-point 2
- restore based on the current state of files and ignore backup/restore points
./your_repo_dir/Restore.sh --action restore --restore-point-type manual
- restore to the lastest commit
- wait until the restore process is finished.
- you also can create a token for access to your repository from this menu
profile -> settings -> Developer Settings -> personal access tokens
on GitHub