Commit e4482af5 authored by xiabin's avatar xiabin

修改计划任务

parent 7cb3c9f9
...@@ -17,10 +17,11 @@ class TaskController extends Controller ...@@ -17,10 +17,11 @@ class TaskController extends Controller
public function actionIndex() public function actionIndex()
{ {
$jobby = new Jobby(); $jobby = new Jobby();
$yiiCommand = $_SERVER['SCRIPT_FILENAME']; $phpBin = '/usr/local/webserver/php537/bin/php -c /usr/local/webserver/php537/etc/crontab.ini ';
$yiiCommand = $phpBin . $_SERVER['SCRIPT_FILENAME'];
$output = Yii::getAlias('@runtime') . "/logs/jobs-" . date('Y-m-d') . ".log"; $output = Yii::getAlias('@runtime') . "/logs/jobs-" . date('Y-m-d') . ".log";
if(YII_DEBUG){ if (YII_DEBUG) {
$time = date('Y-m-d H:i:s'); $time = date('Y-m-d H:i:s');
$jobby->add('CommandExample', [ $jobby->add('CommandExample', [
...@@ -46,14 +47,14 @@ class TaskController extends Controller ...@@ -46,14 +47,14 @@ class TaskController extends Controller
'command' => "$yiiCommand withdraw/settle", 'command' => "$yiiCommand withdraw/settle",
'schedule' => '30 8 * * 1-5', //每周一到周五上午8:30 'schedule' => '30 8 * * 1-5', //每周一到周五上午8:30
'output' => $output, 'output' => $output,
'enabled' => true 'enabled' => TRUE
]); ]);
$jobby->add('ClearUploadPool', [ $jobby->add('ClearUploadPool', [
'command' => "$yiiCommand maintain/clear-upload-pool", 'command' => "$yiiCommand maintain/clear-upload-pool",
'schedule' => '15 */2 * * *', //每隔两小时的第15分钟 'schedule' => '15 */2 * * *', //每隔两小时的第15分钟
'output' => $output, 'output' => $output,
'enabled' => true 'enabled' => TRUE
]); ]);
$jobby->run(); $jobby->run();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment