Skip to content

Instantly share code, notes, and snippets.

@victor-abz
Created June 14, 2023 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victor-abz/2745e1a84831ad1eab8e5ab42c4eee3a to your computer and use it in GitHub Desktop.
Save victor-abz/2745e1a84831ad1eab8e5ab42c4eee3a to your computer and use it in GitHub Desktop.
Used for backing up Frappe/ERPNext sites to github repo
#!/bin/bash
# Used for backing up Frappe/ERPNext sites
# Adjust details and add as cron job on server to automate backups
# Script to backup all sites in Frappe Bench to GitHub
# Switch to bench directory and
# Backup all sites with files to backup folder
# Backup files can be easily restored on a new frappe bench
# Backup Sites
# Add the following line for each site
# Backup location should hold local version of your git repository with backups
cd /opt/bench/erpnext && bench --site [site name] backup --with-files --compress --backup-path=[backup location]
# Backup to https://github.com/[username]/[repository]
# First add SSL (to avoid manually entering username and password) via github settings page
cd /opt/bench/backups && git remote set-url origin git@github.com:[username]/[repository].git && git add . && git commit -m "[your standard comment]" && git push origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment