AutomationFlowsGeneral › Database Backup

Database Backup

Database Backup. Uses executeCommand, emailSend. Scheduled trigger; 5 nodes.

Cron / scheduled trigger★★★★☆ complexity5 nodesExecute CommandEmail Send
General Trigger: Cron / scheduled Nodes: 5 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Database Backup",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "daysInterval": 1,
              "triggerAtHour": 2
            }
          ]
        }
      },
      "id": "daily-backup",
      "name": "Daily at 2AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "command": "pg_dump -h postgres -U easycv -d easycv -F c -f /backups/easycv_$(date +%Y%m%d_%H%M%S).dump"
      },
      "id": "pg-dump",
      "name": "PostgreSQL Dump",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "command": "find /backups -name 'easycv_*.dump' -mtime +7 -delete"
      },
      "id": "cleanup-old",
      "name": "Cleanup Old Backups",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.exitCode }}",
              "operation": "notEqual",
              "value2": 0
            }
          ]
        }
      },
      "id": "check-error",
      "name": "Backup Failed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "fromEmail": "easycv@yourdomain.com",
        "toEmail": "admin@yourdomain.com",
        "subject": "\u26a0\ufe0f EasyCV Backup Failed",
        "text": "Database backup failed at {{ $now }}\n\nError: {{ $json.stderr }}"
      },
      "id": "alert-failure",
      "name": "Alert on Failure",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "position": [
        1050,
        200
      ]
    }
  ],
  "connections": {
    "Daily at 2AM": {
      "main": [
        [
          {
            "node": "PostgreSQL Dump",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PostgreSQL Dump": {
      "main": [
        [
          {
            "node": "Cleanup Old Backups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cleanup Old Backups": {
      "main": [
        [
          {
            "node": "Backup Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backup Failed?": {
      "main": [
        [
          {
            "node": "Alert on Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "easycv",
    "backup",
    "maintenance"
  ]
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Database Backup. Uses executeCommand, emailSend. Scheduled trigger; 5 nodes.

Source: https://github.com/Dwaynor/easycv/blob/fdfbf194d0942ebda185be574a7371d2bddd4161/n8n/workflows/backup.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Complete backup solution that saves both workflows and credentials to local/server disk with optional FTP upload for off-site redundancy.

Read Write File, Email Send, Execute Command +3
General

IA Leilão Imóveis - Automação Semanal. Uses executeCommand, emailSend. Scheduled trigger; 8 nodes.

Execute Command, Email Send
General

JobSearch Stale Alert. Uses executeCommand, emailSend. Scheduled trigger; 4 nodes.

Execute Command, Email Send
General

Perfect for content publishing with organic scheduling patterns, social media automation, API systems that need to avoid rate limiting, or any automation requiring randomised timing control across mul

n8n, Read Write File, Stop And Error +1
General

Perfect for disaster recovery or migrating between environments, this workflow automatically identifies your most recent FTP backup and provides a manual restore capability that intelligently excludes

Email Send, Ftp, Read Write File +2