CRONJOB is not working in my subdomain.
I have restarted cron but still not working! Please help me to solve it.
#After running the crontab -l command.
CRONJOB is not working in my subdomain.
I have restarted cron but still not working! Please help me to solve it.
#After running the crontab -l command.
Yes, for a Laraval project. and this is the cron should be!
Try the system wide cron nano /etc/crontab
add this line at the end to run every minute so that we confirm if it ran:
* * * * * root /usr/bin/wget -O - https://website.com/export-txt.php >> /home/mydomain.com/public_html/output.txt
why wget its just my preference.
You can use CyberPanel to handle your cronjobs by adding
php /home/mydomain.com/public_html/test.php >> /home/mydomain.com/public_html/output.txt
To use a different PHP version:
/usr/local/lsws/lsphp81/bin/php /home/mydomain.com/public_html/test.php >> /home/mydomain.com/public_html/output.txt
For quiet mode:
php -q /home/mydomain.com/public_html/test.php >> /home/mydomain.com/public_html/output.txt
Have you tried running the command on ssh to see if you get an output do not use quiet flag or you can pipe it to edit output.txt
Looks like you made a mistake wget -o https://website.com
should be invest.luveendu.com
if thats where export-txt.php
exists
I believe this website is not reachable. Have you checked if you can visit said website?
Yes, its fully reachable.
My Laravel Project routes file…
and more over it, I used to host my site in AWS but now I have migrated to Linode. At AWS it used to work perfectly.
I think the Main Problem is that, The cron Should be run by its own subdomain cron option available in Cyberpanel. Or I think there’s some issues with cyberpanel that the crons are not running.
This does not return anything. Have you tried to fix permissions in FIle Manager?
Does this need to return a html or json or just raw data?
This is the Full Code…
Is there anything I just missed.
public function profitSend(){
$gs = Generalsetting::first();
$invest = Invest::orderBy('id','desc')->whereStatus(1)->get();
$day_offs = explode(' ',$gs->day_of);
foreach ($invest as $key => $data) {
if(now()->gt($data->profit_time)){
if($data->lifetime_return == 0){
$this->addProfit($data);
$this->addUserInterestBalance($data);
$this->investComplete($data);
}
if($gs->day_of != NULL){
if($this->isDayOff($data->profit_time->format('D'),$day_offs)){
if($data->plan->lifetime_return == 1){
$this->addHoldBalance($data);
return false;
}else{
if($data->plan->profit_repeat>$data->profit_repeat ){
$this->addHoldBalance($data);
return false;
}
}
}
}
if($data->plan->lifetime_return == 1){
$this->addProfit($data);
$this->addUserInterestBalance($data);
}else{
if($data->plan->profit_repeat>$data->profit_repeat ){
$this->addProfit($data);
$this->addUserInterestBalance($data);
}
}
}
}
}
You were right. I just missed a return:false; in my code.
Thank You Very Much for giving me your time.
Hey, @josephgodwinke there’s the error still exist.
I just modified the code. then run wget https://invest.luveedu.com/profit/send and it worked magically but the problem is that the cron is not running this command.
Please help me to solve the issue.
There is no data that is returned. I have tried several ways of getting data off that url but it just returns a blank output. Kindly add data to your database
Check older messages !
As far as am concerned the cronjob works.
you just have to follow best practices for your code. If you want your code to invoke the databse for a list of anything then you should return JSON HTTP Tests - Laravel - The PHP Framework For Web Artisans
Use a return statement at the end. Look at this GitHub - alexeymezenin/laravel-best-practices: Laravel best practices
If you require help with your laravel code kindly go to laravel forums and communities instead.
No No the Code is fixed, I have fixed it.
How ----> I was missing a return:false; code in my line. So it was not reflecting anything.
And the CRON Problem is also fixed.
How -----> The CROND was stopped. I just restart it and boom, now cron is working perfectly.