I'm trying to bring incremental backups to one old setup. The script I create worked perfectly when run directly. However when I run it from crontab or when redirecting shell output all data is written to stdout.

mysqldump --compact -T /some/backups/$db/ $db

It looks like -T doesn't work correctly in this case. Can someone share any experience of creating backups in a -T way?

Thank you.

  • When running from cron you're going to have to specify the full path to the output directory – Philᵀᴹ Apr 24 '19 at 13:36
  • @Philᵀᴹ, yep, I'm doing exactly that. The script doesn't change at all and under cron it just writes data to stdout. – kworr Apr 24 '19 at 18:59
  • @kworr - _backups/$db/ is not a "full path", it is "relative" to the current directory. – Rick James Apr 29 '19 at 16:21
  • @RickJames, 0k, I fixed that in the question. – kworr Apr 30 '19 at 18:07
  • How about building a test case that anyone could run. Perhaps the "redirecting" case would be simpler than providing crontab commands. – Rick James Apr 30 '19 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.