1

I have the below command set up for backing up

db:backup --database=mysql --destination=s3 --destinationPath=date +\test/%Y%m%d%H%M%S.sql--compression=gzip

Code works fine as command

Fails with local.ERROR: exception 'BackupManager\ShellProcessing\ShellProcessFailed' with message 'sh: mysqldump: command not found when the same is run from scheduler.

Any suggestions.

de-bugged
  • 935
  • 4
  • 14
  • 34
  • Take a look at this: http://stackoverflow.com/questions/2135478/how-to-simulate-the-environment-cron-executes-a-script-with , since I think it's related to different environment issues when running through crontab – Amarnasan May 22 '16 at 09:36
  • @Amarnasan is probably right, but please post your command as well so it's easier to tell. – Joel Hinz May 22 '16 at 09:39
  • Hi @Amarnasan, My scheduler works fine, since i have other scheduler commands which works fine. Regarding the backup commans, its from laravel backup plugin https://github.com/backup-manager/laravel – de-bugged May 22 '16 at 09:56
  • Seems like a `path` problem. Try specifying `mysqldump` full path in your script: something like `/usr/bin/mysqldump` – Arcesilas May 22 '16 at 11:54

1 Answers1

0

Yep figured out the details.

shell path was not initialised when running as cron

Solution was to create as shell script and call it from cron with bash_profile initiated before cron

crontab

* * * * * bash /path/cron.sh

cron.sh

. .bash_profile
<cron command>
de-bugged
  • 935
  • 4
  • 14
  • 34