Answer the question
In order to leave comments, you need to log in
How to organize automatic backup of PostgreSQL databases via cron?
Good afternoon, to create a backup of Postgres databases, I use the command
pg_dump gitlab > /DATA/backups/gitlab`date +%d-%m-%Y`
Everything works the way I want, but if I put this command in cron, then after executing this command a message with information in /var/mail/postgres falls, with the error text
/bin/sh: 1: Syntax error: EOF in backquote substitution
I understand that something is wrong in the syntax, but how to fix this error? Thanks in advance for all the help
Answer the question
In order to leave comments, you need to log in
We read man 5 crontab
and see
That is, the percent sign in the cron configuration file is perceived as a newline character. To prevent this from happening, it must be escaped with a backslash.
pg_dump gitlab > /DATA/backups/gitlab`date +\%d-\%m-\%Y`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question