Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
591 views
in Technique[技术] by (71.8m points)

laravel spatie database backup to google drive on cpanel

Hi i am using spatie(spatie/laravel-backup) package for database backup. Also using nao-pon/flysystem-google-drive package for google drive upload using laravel schedule command. Here is command code

    $schedule->command('database:check')->everyMinute();
    $schedule->command('backup:clean')->everyMinute();
    $schedule->command('backup:run --only-db')->everyMinute();

When i run php artisan schedule:run on my local then i get a zip file on my google drive.But when i run this on cpanel then i didn't get any file in my google drive. Here is code for cron job

/usr/local/bin/php /home/masumcom/binary.masum3.com/artisan 
schedule:run

One command run perfectly but other two not working perfectly

$schedule->command('database:check')->everyMinute();

Only this one working perfectly

question from:https://stackoverflow.com/questions/65849869/laravel-spatie-database-backup-to-google-drive-on-cpanel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

try this

/usr/local/bin/php /home/replaceyourdirectoryname/public_html/artisan schedule:run > /dev/null 2>&1

or in any controller try

use IlluminateSupportFacadesArtisan;
Artisan::call('schedule:run');
dd(Artisan::output()); // here you can see error in or echo Artisan::output();

or go to storage/log/laravel.log read error log

or go to cpanel open mail check error in your mail

or read https://stackoverflow.com/a/65890498/14913109


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...