I am using laravel 5.2 and I have my jobs set up as:
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\App\Console\Commands\FetchTweets::class,
\App\Console\Commands\FetchTweetMentions::class,
\App\Console\Commands\FetchTweetListsAddedToo::class,
\App\Console\Commands\LogRotater::class,
\App\Console\Commands\FetchReadMes::class,
\App\Console\Commands\FetchEveMarketPrices::class,
\App\Console\Commands\FetchEveRegions::class,
\App\Console\Commands\FetchEveMarketGroupInformation::class,
\App\Console\Commands\FetchEveMarketTypes::class,
\App\Console\Commands\FetchEveOnlineRegionTypeHistoryInformation::class,
\App\Console\Commands\CleanEveTables::class,
\App\Console\Commands\PublishTweets::class,
\App\Console\Commands\FetchTwitterBlocks::class,
\App\Console\Commands\FetchTwitterFollowers::class
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// ...
$schedule->command('log_rotater')
->everyThirtyMinutes()
->withoutOverlapping()
->appendOutputTo('storage/logs/log_rotation.log');
}
}
I have commented out the other jobs because I feel if I fix one it will fix them all or I'll have a way to fix them all. Essentially this job never runs.
Ever.
How do I know this? The log files its suppose to rotate grow in size to well over a few gigs when they are never suppose to be bigger then a meg. I use to have this set to daily, but now I changed it to every half hour.
It still doesn't run.
I can run it manually by doing php artisan log_rotator
and there are no errors, it runs, it rotates the logs life is grand.
But it doesn't seem to want to run when scheduled.
Ideas?
Have you created the actual cronjob to run the scheduler?
# m h dom mon dow command
* * * * * php ~/personal_site/artisan schedule:run >> /dev/null 2>&1
Does the command even work?
This is an example of one of the outputs:
xxx@ubuntu:~$ php ~/personal_site/artisan schedule:run
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c; '/usr/bin/php7.0' 'artisan' fetch_tweets; rm /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c) >> 'storage/logs/tweets.log' 2>&1 &
So .... yes yes it does.
Help
Update two
The following should pretty much tell you anything you need to know.
xxx@ubuntu:~$ php /home/xxx/personal_site/artisan schedule:run >> /home/xxx/personal_site/storage/cron.log 2>&1
xxx@ubuntu:~$ cd personal_site/storage/
xxx@ubuntu:~/personal_site/storage$ cat cron.log
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c; '/usr/bin/php7.0' 'artisan' fetch_tweets; rm /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c) >> 'storage/logs/tweets.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-8f666afb45a162c3e7fcdd31c3b7334b7321f169; '/usr/bin/php7.0' 'artisan' fetch_twitter_blocks; rm /home/xxx/personal_site/storage/framework/schedule-8f666afb45a162c3e7fcdd31c3b7334b7321f169) >> 'storage/logs/tweet_block.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-00cca655481aaf25de2c659589a2eb94feaf5775; '/usr/bin/php7.0' 'artisan' fetch_twitter_followers; rm /home/xxx/personal_site/storage/framework/schedule-00cca655481aaf25de2c659589a2eb94feaf5775) >> 'storage/logs/twitter_followers.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-ee75cb261c4f273c31e1c7ce526ee8ad0b810907; '/usr/bin/php7.0' 'artisan' fetch_tweet_mentions; rm /home/xxx/personal_site/storage/framework/schedule-ee75cb261c4f273c31e1c7ce526ee8ad0b810907) >> 'storage/logs/tweet_mentions.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-3b5a4c06df2d042fff061daba42e20e7e4ff43fc; '/usr/bin/php7.0' 'artisan' fetch_tweet_lists_added_too; rm /home/xxx/personal_site/storage/framework/schedule-3b5a4c06df2d042fff061daba42e20e7e4ff43fc) >> 'storage/logs/tweet_list.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c; '/usr/bin/php7.0' 'artisan' fetch_tweets; rm /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c) >> 'storage/logs/tweets.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-8f666afb45a162c3e7fcdd31c3b7334b7321f169; '/usr/bin/php7.0' 'artisan' fetch_twitter_blocks; rm /home/xxx/personal_site/storage/framework/schedule-8f666afb45a162c3e7fcdd31c3b7334b7321f169) >> 'storage/logs/tweet_block.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-00cca655481aaf25de2c659589a2eb94feaf5775; '/usr/bin/php7.0' 'artisan' fetch_twitter_followers; rm /home/xxx/personal_site/storage/framework/schedule-00cca655481aaf25de2c659589a2eb94feaf5775) >> 'storage/logs/twitter_followers.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-ee75cb261c4f273c31e1c7ce526ee8ad0b810907; '/usr/bin/php7.0' 'artisan' fetch_tweet_mentions; rm /home/xxx/personal_site/storage/framework/schedule-ee75cb261c4f273c31e1c7ce526ee8ad0b810907) >> 'storage/logs/tweet_mentions.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-3b5a4c06df2d042fff061daba42e20e7e4ff43fc; '/usr/bin/php7.0' 'artisan' fetch_tweet_lists_added_too; rm /home/xxx/personal_site/storage/framework/schedule-3b5a4c06df2d042fff061daba42e20e7e4ff43fc) >> 'storage/logs/tweet_list.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-1357d5ceb1399278a39d91725089a0df39036ecc; '/usr/bin/php7.0' 'artisan' publish_tweets; rm /home/xxx/personal_site/storage/framework/schedule-1357d5ceb1399278a39d91725089a0df39036ecc) >> 'storage/logs/sent_tweets.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c; '/usr/bin/php7.0' 'artisan' fetch_tweets; rm /home/xxx/personal_site/storage/framework/schedule-1b9fbd28988b6ce27513da6dcf3d00eec059484c) >> 'storage/logs/tweets.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-8f666afb45a162c3e7fcdd31c3b7334b7321f169; '/usr/bin/php7.0' 'artisan' fetch_twitter_blocks; rm /home/xxx/personal_site/storage/framework/schedule-8f666afb45a162c3e7fcdd31c3b7334b7321f169) >> 'storage/logs/tweet_block.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-00cca655481aaf25de2c659589a2eb94feaf5775; '/usr/bin/php7.0' 'artisan' fetch_twitter_followers; rm /home/xxx/personal_site/storage/framework/schedule-00cca655481aaf25de2c659589a2eb94feaf5775) >> 'storage/logs/twitter_followers.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-ee75cb261c4f273c31e1c7ce526ee8ad0b810907; '/usr/bin/php7.0' 'artisan' fetch_tweet_mentions; rm /home/xxx/personal_site/storage/framework/schedule-ee75cb261c4f273c31e1c7ce526ee8ad0b810907) >> 'storage/logs/tweet_mentions.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-3b5a4c06df2d042fff061daba42e20e7e4ff43fc; '/usr/bin/php7.0' 'artisan' fetch_tweet_lists_added_too; rm /home/xxx/personal_site/storage/framework/schedule-3b5a4c06df2d042fff061daba42e20e7e4ff43fc) >> 'storage/logs/tweet_list.log' 2>&1 &
Running scheduled command: (touch /home/xxx/personal_site/storage/framework/schedule-1357d5ceb1399278a39d91725089a0df39036ecc; '/usr/bin/php7.0' 'artisan' publish_tweets; rm /home/xxx/personal_site/storage/framework/schedule-1357d5ceb1399278a39d91725089a0df39036ecc) >> 'storage/logs/sent_tweets.log' 2>&1 &
Looking at your shedule method I think this is not correct:
You mention
log_rotater
here; but how does you$signature
look like in\App\Console\Commands\LogRotater::class
It's probably something likelog:rotate
The argument of the
command()
should be an artisan command; so that defined in$signature
in\App\Console\Commands\LogRotater::class
You mention you're scheduler runs; but it only runs the 'FetchTweets' task; nothing else.