django-template/make-a-backup.sh
2021-06-24 10:46:55 +02:00

7 lines
261 B
Bash

#!/usr/bin/env bash
set -e
cd /home/django/project
docker exec -it django_1 python3 manage.py dumpdata --all --indent 4 --natural-primary --natural-foreign > /home/django/backups/dumpdata_$(date +"%Y-%m-%d").json
find /home/django/backups/* -mtime +30 -delete