mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-10 15:20:55 +00:00
e1e1c6b6f9
erpnext-assets - ERPNext nginx config + static assets erpnext-worker - ERPNext python environment frappe-assets - Frappe nginx config + static assets frappe-worker - Frappe python environment frappe-socketio - Frappe socketio process common for apps
30 lines
975 B
Python
30 lines
975 B
Python
import os, frappe, compileall, re
|
|
from frappe.utils.backups import scheduled_backup
|
|
from frappe.utils import now
|
|
from frappe.utils import get_sites
|
|
|
|
def backup(sites, with_files=False):
|
|
for site in sites:
|
|
frappe.init(site)
|
|
frappe.connect()
|
|
odb = scheduled_backup(
|
|
ignore_files=not with_files,
|
|
backup_path_db=None,
|
|
backup_path_files=None,
|
|
backup_path_private_files=None,
|
|
force=True
|
|
)
|
|
print("database backup taken -", odb.backup_path_db, "- on", now())
|
|
if with_files:
|
|
print("files backup taken -", odb.backup_path_files, "- on", now())
|
|
print("private files backup taken -", odb.backup_path_private_files, "- on", now())
|
|
frappe.destroy()
|
|
|
|
installed_sites = ":".join(get_sites())
|
|
sites = os.environ.get("SITES", installed_sites).split(":")
|
|
with_files=True if os.environ.get("WITH_FILES") else False
|
|
|
|
backup(sites, with_files)
|
|
|
|
exit(0)
|