任务调度程序无法在实时服务器CPANEL上使用
当我在CPANEL上设置玉米作业时,我的CRON工作没有在实时服务器上工作。我每分钟向用户发送通知。在实时服务器上,我尝试了终端但不起作用。
这是我调度程序的代码。
protected function schedule(Schedule $schedule)
{
$schedule->call(function(){
$morning_time = inpatient_prescription::whereRaw('morning_time + INTERVAL 5 MINUTE <= CURRENT_TIME() AND date = CURRENT_DATE AND morning_status = 0')
->join('patients','patients.id','inpatient_prescriptions.patient_id')
->join('departments','departments.id','inpatient_prescriptions.department_id')
->join('wards','wards.id','ward_id')
->get();
$evening_time = inpatient_prescription::whereRaw('evening_time + INTERVAL 5 MINUTE <= CURRENT_TIME() AND date = CURRENT_DATE AND evening_status = 0')
->join('patients','patients.id','inpatient_prescriptions.patient_id')
->join('departments','departments.id','inpatient_prescriptions.department_id')
->join('wards','wards.id','ward_id')
->get();
$night_time = inpatient_prescription::whereRaw('night_time + INTERVAL 5 MINUTE <= CURRENT_TIME() AND date = CURRENT_DATE AND night_status = 0')
->join('patients','patients.id','inpatient_prescriptions.patient_id')
->join('departments','departments.id','inpatient_prescriptions.department_id')
->join('wards','wards.id','ward_id')
->get();
if($morning_time->count()!=0){
$user1 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_primary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$user2 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_secondary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$new = $morning_time;
$user1->notify(new dos_reminder($new));
$user2->notify(new dos_reminder($new));
Notification::send($user1, new SlackNotification($new));
event(new MessageNotification('Morning time query executed'));
Log::info('Working');
}
if($evening_time->count()!=0){
$user1 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_primary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$user2 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_secondary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$new = $evening_time;
$user1->notify(new dos_reminder($new));
$user2->notify(new dos_reminder($new));
Notification::send($user1, new SlackNotification($new));
event(new MessageNotification('evening time query executed'));
Log::info('Working');
}
if($night_time->count()!=0){
$user1 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_primary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$user2 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_secondary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$new = $night_time;
$user1->notify(new dos_reminder($new));
$user2->notify(new dos_reminder($new));
Notification::send($user1, new SlackNotification($new));
event(new MessageNotification('Night time query executed'));
Log::info('Working');
}
})->everyMinute();
}
这是我在cpanel中添加的玉米作业命令,
/usr/local/bin/php /home/thetechbond/public_html/goodhealth/artisan schedule:run >> /dev/null 2>&1
它没有执行。请帮忙
My cron job is not working on the live server as I have set up the corn job on cPanel. I am sending notifications to users every minute. On live server I tried from terminal but not working.
Here is the code of my scheduler.
protected function schedule(Schedule $schedule)
{
$schedule->call(function(){
$morning_time = inpatient_prescription::whereRaw('morning_time + INTERVAL 5 MINUTE <= CURRENT_TIME() AND date = CURRENT_DATE AND morning_status = 0')
->join('patients','patients.id','inpatient_prescriptions.patient_id')
->join('departments','departments.id','inpatient_prescriptions.department_id')
->join('wards','wards.id','ward_id')
->get();
$evening_time = inpatient_prescription::whereRaw('evening_time + INTERVAL 5 MINUTE <= CURRENT_TIME() AND date = CURRENT_DATE AND evening_status = 0')
->join('patients','patients.id','inpatient_prescriptions.patient_id')
->join('departments','departments.id','inpatient_prescriptions.department_id')
->join('wards','wards.id','ward_id')
->get();
$night_time = inpatient_prescription::whereRaw('night_time + INTERVAL 5 MINUTE <= CURRENT_TIME() AND date = CURRENT_DATE AND night_status = 0')
->join('patients','patients.id','inpatient_prescriptions.patient_id')
->join('departments','departments.id','inpatient_prescriptions.department_id')
->join('wards','wards.id','ward_id')
->get();
if($morning_time->count()!=0){
$user1 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_primary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$user2 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_secondary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$new = $morning_time;
$user1->notify(new dos_reminder($new));
$user2->notify(new dos_reminder($new));
Notification::send($user1, new SlackNotification($new));
event(new MessageNotification('Morning time query executed'));
Log::info('Working');
}
if($evening_time->count()!=0){
$user1 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_primary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$user2 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_secondary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$new = $evening_time;
$user1->notify(new dos_reminder($new));
$user2->notify(new dos_reminder($new));
Notification::send($user1, new SlackNotification($new));
event(new MessageNotification('evening time query executed'));
Log::info('Working');
}
if($night_time->count()!=0){
$user1 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_primary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$user2 = employee::select('employees.id')->join('attendant_assigns','attendant_assigns.attendant_secondary','=','employees.id')->join('inpatient_prescriptions','attendant_assigns.ward','=','inpatient_prescriptions.ward_id')->first();
$new = $night_time;
$user1->notify(new dos_reminder($new));
$user2->notify(new dos_reminder($new));
Notification::send($user1, new SlackNotification($new));
event(new MessageNotification('Night time query executed'));
Log::info('Working');
}
})->everyMinute();
}
Here is the corn job command I have added in cPanel
/usr/local/bin/php /home/thetechbond/public_html/goodhealth/artisan schedule:run >> /dev/null 2>&1
It is not executing. Please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论