当前位置: 首页>>代码示例>>PHP>>正文


PHP Schedule::exec方法代码示例

本文整理汇总了PHP中Illuminate\Console\Scheduling\Schedule::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::exec方法的具体用法?PHP Schedule::exec怎么用?PHP Schedule::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Console\Scheduling\Schedule的用法示例。


在下文中一共展示了Schedule::exec方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     // :00 :20 :40 Ping all the update URLs for site/variable
     // Limit to Red Butte sites
     $siteCodeContains = ['RB_'];
     // $siteCodeContains = ['RB_', 'PR_', 'LR_'];
     try {
         foreach ($siteCodeContains as $piece) {
             $sites = Site::where('sitecode', 'LIKE', '%' . $piece . '%')->get();
             foreach ($sites as $site) {
                 $series = DB::table('series')->select('variablecode')->where('sitecode', '=', $site->sitecode)->get();
                 foreach ($series as $s) {
                     $sitecode = $site->sitecode;
                     $variablecode = $s->variablecode;
                     $url = url('/sites/' . $site->sitecode . '/' . $s->variablecode . '/update');
                     $schedule->exec("wget -O/dev/null {$url}")->cron('0,20,40 * * * *');
                 }
             }
         }
     } catch (\Exception $ex) {
         // Ignore all exceptions... this will catch if 'php artisan migration' hasn't been done yet
     }
     // :10 :30 :50 Ping the update URLs for cameras
     $url = url('/cameras/update');
     $schedule->exec("wget -O/dev/null {$url}")->cron('10,30,50 * * * *');
 }
开发者ID:bluemath,项目名称:waterapp,代码行数:32,代码来源:Kernel.php

示例2: refreshZedx

 protected function refreshZedx(Schedule $schedule)
 {
     $slug = str_slug(Carbon::now());
     $filePathMigration = storage_path('logs/refresh_' . $slug . '/migration.txt');
     $filePathGit = storage_path('logs/refresh_' . $slug . '/git.txt');
     $schedule->exec('mkdir ' . storage_path('logs/refresh_' . $slug))->daily();
     $schedule->command('down')->daily()->withoutOverlapping()->sendOutputTo($filePathMigration);
     $schedule->command('migrate:refresh --seed')->daily()->withoutOverlapping()->appendOutputTo($filePathMigration);
     $schedule->exec('cd ' . base_path() . ' && git stash')->daily()->sendOutputTo($filePathGit);
     $schedule->command('up')->daily()->withoutOverlapping()->appendOutputTo($filePathMigration);
 }
开发者ID:zedx,项目名称:core,代码行数:11,代码来源:Kernel.php

示例3: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     $schedule->call(function () {
         DB::table('test')->insert(['name' => 'admin']);
     })->everyMinute();
     $schedule->exec('echo test')->everyMinute();
 }
开发者ID:manishdwibedy,项目名称:SCaller,代码行数:14,代码来源:Kernel.php

示例4: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Schedule $schedule)
 {
     $s3_first = Config::get("app.aws.s3_bucket_sync_first");
     $s3_second = Config::get("app.aws.s3_bucket_sync_second");
     $s3_sync = Config::get("app.aws.s3_sync_profile");
     $schedule->exec("aws s3 sync s3://{$s3_first} s3://{$s3_second} --delete --profile {$s3_sync}");
     $type = "AWS S3 SYNC completed.";
     ScheduleLog::setDataLog($type);
 }
开发者ID:pylypen,项目名称:aws-mirroring-purging,代码行数:14,代码来源:AwsS3Sync.php

示例5: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('imgclear')->daily()->at('01:00');
     $schedule->command('backup:clean')->daily()->at('01:30');
     $schedule->command('backup:run')->daily()->at('02:00');
     $schedule->exec('cd ' . storage_path('logs') . ' && : > laravel.log')->daily()->at('02:30');
     $schedule->call(function () {
         Activity::cleanLog();
     })->weekly();
 }
开发者ID:karpuzkan,项目名称:laravel,代码行数:16,代码来源:Kernel.php

示例6: handle

 /**
  * Execute the console command.
  *
  * @param Schedule $schedule
  * @param Event $event
  * @param Record $record
  */
 public function handle(Schedule $schedule, Event $event, Record $record)
 {
     $uptimeRobot = new UptimeRobot(env('UPTIMEROBOT_API'));
     $getMonitors = simplexml_load_string($uptimeRobot->getMonitors());
     foreach ($getMonitors->monitor as $monitor) {
         // Check for the restart signal.
         $check = $event->where('event', 'restart');
         if ($monitor['status'] == 9) {
             // Record the restart
             $event->create(['machine_name' => 'ubuntu-512mb-sgp1-01', 'event' => 'restart']);
             // Check for the record of recent restart
             $recentRestart = $record->where('event', 'restart');
             // If there is a recent record but no signal found
             if ($recentRestart->count() > 0 && $check->count() < 6) {
                 \Mail::send('Email.Down', [], function ($message) {
                     $message->to('hashimalhadad@gmail.com', 'Hashim Ibrahim')->subject('About your server');
                 });
             } else {
                 // 4 hours have been passed.
                 $hoursPassed = $check->where('created_at', '<', 'DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 4 HOUR)');
                 if ($hoursPassed->count() > 0) {
                     if ($schedule->exec('envoy run monitorStatus')) {
                         \Log::info('Envoy ran @ ' . \Carbon\Carbon::now());
                         \Mail::send('Email.Server', ['time' => \Carbon\Carbon::now()], function ($message) {
                             $message->to('hashimalhadad@gmail.com', 'Hashim Ibrahim')->subject('About your server');
                         });
                         // Save this restart to db
                         $record->create(['event' => 'restart']);
                     } else {
                         \Log::info('Envoy is not working @ ' . \Carbon\Carbon::now());
                     }
                 }
                 $check->delete();
             }
         } else {
             $check->delete();
             \Log::info('Monitor status is good @ ' . \Carbon\Carbon::now());
         }
     }
 }
开发者ID:hasibomi,项目名称:ForHashim,代码行数:47,代码来源:MonitorStatus.php

示例7: schedule

 /**
  * Define the application's command schedule.
  * @link http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     /* $schedule->command('queue:listen')->everyMinute();*/
     /*$schedule->command('inspire')
       ->hourly();*/
     // This scheduled task backs up the db at midnight everyday
     $serial_num = BACKUP_LOG::max('serial_num');
     $newSerial_num = sprintf('%08d', $serial_num + 1);
     $currentSerialNum = BACKUP_LOG::find($serial_num);
     $currentSerialNum->serial_num = $newSerial_num;
     $currentSerialNum->save();
     // This shell command will be executed at Midnight everyday
     $schedule->exec('mysqldump -u' . env('DB_USERNAME') . ' -p' . env('DB_PASSWORD') . ' ' . env('DB_DATABASE') . ' > ' . env('BACKUP_PATH') . $newSerial_num . "_scheduled_backup_`date`" . '.sql')->daily();
     /*// This shell command will be executed at the specified time everyday
       // Test this with php artisan schedule:run
       $schedule->exec('mysqldump -u'.env('DB_USERNAME').' -p'.env('DB_PASSWORD').' '.env('DB_DATABASE').' > '.env('BACKUP_PATH').$newSerial_num."_scheduled_backup_`date`".'.sql')
           ->dailyAt("14:34");*/
     $newNotification = new Notifications();
     $newNotification->notification = "Backup successful!";
     $newNotification->body = 'Backup #' . $newSerial_num . ' created.';
     $newNotification->readStatus = '0';
     $newNotification->save();
 }
开发者ID:nilesh93,项目名称:HOTEL_RESERVATION,代码行数:30,代码来源:Kernel.php

示例8: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->exec('composer self-update')->daily();
     $schedule->command('releases:clear-old')->everyThirtyMinutes();
 }
开发者ID:bigbitecreative,项目名称:paddle,代码行数:11,代码来源:Kernel.php

示例9: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     $schedule->exec('env GIT_SSL_NO_VERIFY=true git pull')->everyFiveMinutes();
 }
开发者ID:roslairy,项目名称:phil,代码行数:11,代码来源:Kernel.php

示例10: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     $schedule->exec('mysqldump -uroot -pa laravel > backup.sql')->dailyAt('09:45');
 }
开发者ID:cookies5127,项目名称:cookiesblog,代码行数:11,代码来源:Kernel.php

示例11: schedule

 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     $schedule->exec('chmod -R 777 /public/images')->everyMinute();
 }
开发者ID:Arbaz75,项目名称:lara_chat,代码行数:11,代码来源:Kernel.php


注:本文中的Illuminate\Console\Scheduling\Schedule::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。