Enable web cron?

How do you enable web cron?

I’ve added the webcron WEBCRON_SECRET=password
to the env. file and then I ran the web cron:
https://domain.com/webcron?secret=mykey.

But that results in this error message:
{"message":"Web cron has not been configured"}

So what am I missing here? :thinking:

Thanks in advance.
Kind regards
`

Hi,

Maybe you need to run php artisan optimize after changing the .env file

@david do you have any suggestions?

1 Like

@hillel correct, looks like the .env var isn’t being read - so an optimize should fix this.

1 Like

i did try that and this is what happens:

image
Do I need to add the full path to the installation?

Kind regards

Right, i figured it out. Added the path and suddenly the “magic” was there.
image
image

Thanks a bunch guys! :smirk:
Kind regards
AngryWarrior

Hmm cron jobs are still falling? :thinking:

Now I really do not know what to do…

I set up the web cron because the normal cron jobs didn’t seem to work properly.
So what do to now? :confused:

Kind regards

Nevermind I got it to work…

What did you do ? it’d be nice to see what others do to fix errors…

Hello @freebs

In the env config file in your web root you need you add this line:
https://domain.com/webcron?secret=mykey .
where my key is altered to a secure secret key.

Then login to your server and open your Linux command prompt, cd to your ninja installation folder and type:
sudo php artisan optimize
This will optimize the file and force it to be re-read by Invoice Ninja system.

The you need to set up the webcron. I suggest you use a cron service as described here: I found this cool site for running cron-jobs for free. | Business, Marketing & SEO Forums
which is also free to use. :smirk:

Now in that cron job you add the address and secret key to be called by the cron:
https://domain.com/webcron?secret=mykey

and if you see it being called successfully then you know you it is working… :+1:

Cheers! :smiley: :beer:
AngryWarrior.

2 Likes

@AngryWarrior - Thanks! Does above webcron gets rid of CRONS NEED TO BE ENABLE warning within InvoiceNinja v5?

Just do what I have done above in this forum thread and it will work…
Kind regards
AngryWarrior