N
N
n3162020-03-27 18:42:36
linux
n316, 2020-03-27 18:42:36

crrontab failing job?

Hello, I'm sorry if this is a stupid question, but I don't know what to do anymore. In Linux relatively recently, I wrote a command for archiving a database from MySQL:
mysqldump --defaults-extra-file=/home/ubuntu/.my.cnf euro_deniz | gzip > `date +/backup/backupdb_euro_deniz_%Y%m%d.%H%M%S.sql.gz` - from terminal everything works fine without sudo.
In crontab, the job looks like this:
* * * * * mysqldump --defaults-extra-file=/home/ubuntu/.my.cnf euro_deniz | gzip > `date +/backup/backupdb_euro_deniz_%Y%m%d.%H%M%S.sql.gz`.
Judging by the content of syslog.log, cron works, but the file is not created, it writes in the log:
Mar 27 15:38:01 ip-172-31-17-133 CRON[2815]: (ubuntu) CMD (mysqldump --defaults-extra-file=/home/ubuntu/.my.cnf euro_deniz | gzip > `date +/backup/backupdb_euro_deniz_)
Mar 27 15:38:01 ip-172-31-17-133 CRON[2812]: (CRON) info (No MTA installed, discarding output)
permissions on .my.cnf file - 770, on backup folder 777
Thank you in advance for your answers.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ronald McDonald, 2020-03-27
@Zoominger

mysqldump

You should specify the full path, what is it there? Something like /bin/mysqldump.

K
ky0, 2020-03-27
@ky0

Judging by

* * * * * mysqldump --defaults-extra-file=/home/ubuntu/.my.cnf euro_deniz | gzip > `date +/backup/backupdb_euro_deniz_%Y%m%d.%H%M%S.sql.gz`
, for starters, you forgot the username after the execution schedule. Unless, of course, it's really a crontab.
In general - the first suspect, as always - relative paths, initial directory and environment variables.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question