Hello everyone and thank you in advance.
I have written a job in the mysql user crontab, but it doesn't run at all. I think my code is correct, because it works properly if I execute it pointing to a script from my user's crontab:
00 12 * * * /usr/bin/mariadb-dump -u root -pMyPassword --lock-tables -A > /full/path/"`date +"%Y-%m-%d"`".sql && rm /full/path/"`date -d '-2 days' '+%Y-%m-%d'`".sql
But it does not work when I point at it from the mysql user's crontab:
00 12 * * * /full/path/to/script
I have also tried running it directly escaping the % signs, but that didn't help either.
I have tried running the script with and without specifying source, even though I am not sure how that would help:
#!/bin/bash
source /full/path/to/my/user/.zshrc
00 12 * * * /usr/bin/mariadb-dump -u root -pMyPassword --lock-tables -A > /full/path/"`date +"%Y-%m-%d"`".sql && rm /full/path/"`date -d '-2 days' '+%Y-%m-%d'`".sql
I have also added an extra blank line to the bottom of the crontab. It didn't help, and the journal doesn't tell me much.
I have also tried changing the permissions for the folder and its contents. Now, it's on 775, and I have added the mysql user to the group, but it still doesn't work.
Any ideas what might be wrong with my set-up?