Home » Questions » Computers [ Ask a new question ]

Having trouble running a cron job in Unix which generates a dynamic filename for an output data dump

Having trouble running a cron job in Unix which generates a dynamic filename for an output data dump

I am trying to schedule a MySQL database dump by using cron but I get an error for some code that I know works when I call directly in Shell.

Asked by: Guest | Views: 230
Total answers/comments: 1
Guest [Entry]

"Try:

mysqldump -uUSER -pPASS DB > /path/to/backup/backup_`date +""\%Y\%m\%d\%H\%M\%S""`.sql

an easier solution in the future would be to place your command which works in bash, into a shell script, then run the shell script from cron. If it works in bash, it will work in a shell script."