Search code examples
linuxcronbackupcpanel

Syntax error near unexpected token `newline' in cPanel


I am trying to back up my database in Laravel using Spatie package. Every thing worked fine till 31 Decemeber 2020 and in New Year my cron job stoped working. I don't know what happened, but on my cPanel mail I am receiving this email:

/usr/local/cpanel/bin/jailshell: -c: line 0: syntax error near unexpected token `newline'
/usr/local/cpanel/bin/jailshell: -c: line 0: `/usr/local/bin/php /home2/scoopscr/public_html/artisan backup:run 1>> '

and this is the cron job I am applying:

/usr/local/bin/php /home2/scoopscr/public_html/artisan backup:run 1>> /dev/null 2>&1

Solution

  • possible solutions

    1. check your php version and php multimanager in cpanel both match or not
    2. go to storage/log/laravel log read cron error
    3. in any controller use

    use Illuminate\Support\Facades\Artisan; Artisan::call('backup:run'); dd(Artisan::output()); now you can check your command working or not and able to find errors