简体   繁体   中英

Laravel command not working as cron

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM