简体   繁体   中英

Executing laravel commands in cron as a shell command

I'm using cPanel to create a cron like so:

* * * * * /home/elsdqscy/folder/update_db.sh > update_db.txt

Inside my shell file I have:

#!/bin/bash

cd folder && php artisan migrate:fresh --seed --force

This should work, knowing that the command /home/elsdqscy/folder/update_db.sh works in the terminal.

I do get this error in the output file:

In ArgvInput.php line 246:
                                           
  Invalid argument supplied for foreach()  

Content-type: text/html; charset=UTF-8

Any idea what am I doing wrong?

You need to provide the full path inside your shell file as well, like so:

cd folder && /usr/bin/php artisan migrate:fresh --seed --force

Did you try

* * * * * cd /home/elsdqscy/folder/update_db.sh > update_db.txt

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