Scheduled Cron Job not running in Godaddy Share Hosting - php

I'm trying to install an investment script in my godaddy hosting, but when I program the cronjob that automatically schedules the return of interest for hours, days, weeks and months, it does not work. I tried to add a job to my GoDaddy hosting shared, but none of these ways has worked for me:
php-cli /home/ruv2g9bvs29z/public_html/cronlab/artisan schedule:run >> /dev/null 2>&1
php72 /home/ruv2g9bvs29z/public_html/cronlab/artisan schedule:run >> /dev/null 2>&1
/usr/local/bin/php ~/public_html/ruv2g9bvs29z/artisan schedule:run >> /dev/null 2>&1
4.php /home/ruv2g9bvs29z/public_html/cronlab/artisan schedule:run >> /dev/null 2>&1
The structure folder where the artisan file is located is like the image:
the cronjob programming instructions from the script provider:
The Kernel:
Can someone help me with this please?

Related

laravel artisan command cron job is not working on ubuntu server

I am new to Ubuntu server and i install cron job and then make new cron job and no idea why its not working. My application is in Laravel so i have to run artisan command through cron job! When i am in project through root cmd artisan-command run properly but in cron did not run it.
here is my cron job listed
I check the if its running or not like this:
# sudo grep -i cron /var/log/syslog|tail -3
This is the output:
Jan 21 09:30:01 liedergut CRON[5222]:(root) CMD (/path/to/php/bin/php /var/www/html/artisan shows:fetchrss >> /dev/null 2>&1)
Jan 21 09:30:01 liedergut CRON[5223]: (root) CMD (php /var/www/html/artisan shows:fetchrss >> /dev/null 2>&1)
Most certainly /var/www/html/php and /path/to/php/bin/php do not exist. You can find out where the php executable is by using whereis php (as you stated in your comment, it is /usr/bin/php). So to make your artisan command run every minute your cron line should be
* * * * * /usr/bin/php /var/www/html/artisan shows:fetchrss >> /dev/null 2>&1
I would suggest though to run Laravel's scheduler every minute:
* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
and schedule your artisan command inside of Laravel, as written on Laravel's task scheduling documentation. This way you can manage your scheduled jobs or re-schedule them without having to edit/touch your crontab.
This command works for me
* * * * * cd /var/www/html/projectname && php artisan schedule:run >> /dev/null 2>&1

laravel 5.5 schedule:run cron job not working in cpanel

I'm have a laravel5.5 project up on shared hosting and trying to run cron job to execute the command "schedule:run" but it just won't execute I think I'm writing the command wrong:
/usr/local/bin/php home/schoolco/prototype/artisan schedule:run >> /dev/null 2>&1
where prototype in the name of my laravel project.
the command works in this directory using ssh.
please if you have any observation or thought share it.
Try like this
/usr/local/bin/php /home/schoolco/prototype/artisan schedule:run > /dev/null 2>&1
And check are you calling right php executable in your terminal with:
$ which php
Maybe it is not /usr/local/bin/php , maybe /usr/bin/php
If your Project is in Root Directory
cd /home/cpanel/public_html && /usr/local/bin/ea-php72 artisan schedule:run >> /dev/null 2>&1
If your Project in a folder within Public_Html then use below
cd /home/cpanel/public_html/folder_name && /usr/local/bin/ea-php72 artisan schedule:run >> /dev/null 2>&1
Hope it will work for you. Thanks
I solved the issue by specifying the php version in the command line:
* * * * * /usr/local/bin/ea-php71 /home/nemanu/root1/artisan schedule:run >> /dev/null 2>&1

Crontab isn't running Laravel scheduled jobs

I've set up crontab on my AWS-EC2 instance to hit the Laravel scheduling endpoint every minute via the root account using sudo crontab-e:
* * * * * php ~/htdocs/artisan schedule:run >> /dev/null 2>&1
However, despite to the cron logs showing it is indeed running every minute:
Jan 26 12:02:01 ip-172-31-28-116 CRON[5057]: (root) CMD (php ~/htdocs/artisan schedule:run >> /dev/null 2>&1)
the job itself isn't executing.
Running the command php ~/htdocs/artisan schedule:run >> /dev/null 2>&1 straight up triggers the job and works.
I'm really struggling with what is going wrong here, am I missing something?
So, I failed to heed the cron output "No MTA installed, discarding output" - Upon installing an MTA (postfix, via sudo apt-get install postfix), it turned out that for the cronjob, php wasn't findable.
Changing the command to use the output of which php to:
/opt/bitnami/php/bin/php /home/bitnami/htdocs/artisan schedule:run
is now working.
Thanks for your help!
Use absolute paths when adding cron entries. ~/htdocs/artisan that should be set using the full path to your application root directory.
It works when you manually run the command because your environment is set accordingly. Not the case when adding cron entries using sudo.

Laravel Schedular not working automatically in server (CPanel)

I have this in my Kernal.php
$schedule->call(function () {
DB::table('news')->delete();
})->everyMinute();
when i do
php artisan schedule:run
it works fine.
But when i use cpanel and write in cron job
php /home/allnewsnepal/public_html/artisan schedule:run >> /dev/null 2>&1
the code doesnt run automatically.I dont have access to shell of cpanel.
For cron's in cPanel, you can look in this post:
Run a PHP file in a cron job using CPanel
The things that you should pay attention to are:
Global path of your PHP (e.g. /usr/bin/php)
Global path of your Laravel (e.g. /var/www/html/LaravelProjectName)
In order to start a cron job on Linux based systems, you must specify the user for that cron, let's say the user is root, so the cron job would look like this:
root php /home/allnewsnepal/public_html/artisan schedule:run >> /dev/null 2>&1
Of course with * prefixes depending on your cron schedule
Thanx for the help .
I got my problem solved by doing
php-cli -q /home/allnewsnepal/public_html/artisan schedule:run

Laravel artisan cron task not working on ubuntu

I have been pulling my hair out for the past 5 hours over what I thought would be a simple task, enabling the cron feature for Laravel. I am running Laravel 5.1 on an Amazon EC2 Ubuntu LAPP stack server.
I have added the cron task to the cron jobs list using the command
sudo crontab -e
Then I have added the command listed in the laravel documentation
* * * * * php /home/bitnami/htdocs/project/app/artisan schedule:run >> /dev/null 2>&1
I have made sure that cron is running and I can see that the task is running if I run
sudo grep -i cron /var/log/syslog|tail -3
Which returns
Mar 4 15:36:01 ip-172-31-7-174 CRON[15120]: (root) CMD (php /home/bitnami/htdocs/project/app/artisan schedule:run >> /dev/null 2>&1)
Mar 4 15:37:01 ip-172-31-7-174 CRON[15123]: (root) CMD (php /home/bitnami/htdocs/project/app/artisan schedule:run >> /dev/null 2>&1)
Mar 4 15:38:01 ip-172-31-7-174 CRON[15125]: (root) CMD (php /home/bitnami/htdocs/project/app/artisan schedule:run >> /dev/null 2>&1)
I have tested that the path has not got any typos in it by running the command from the command line and it works properly
php /home/bitnami/htdocs/project/app/artisan schedule:run
Also I have added this cron task just to confirm that cron is actualy running
* * * * * echo "Cron" > /home/bitnami/htdocs/project/app/artisan/file.txt
I have also made sure the file is executable by doing the following but this has not fixed the issue either
chmod 755 artisan
chmod 777 artisan (I am aware this is dangerous)
chmod +x artisan (Suggested on fourms)
Does anyone have any suggestions where I'm going wrong here.
I've experienced this and found a solution. It's because of unknown reason in bitnami, so that php command not recognized by cron. I used this command to make it working :
* * * * * /path/to/php/bin/php /home/bitnami/htdocs/project/app/artisan schedule:run 1>> /dev/null 2>&1

Categories