How to run static publish queue without having to login

Silverstripe Version: 4.13

Question:

I have static publish queue installed and can run jobs from the CMS admin interface. I can also run the silverstripe/framework/cli-script.php in terminal on my server and can run ProcessJobQueueTask successfully. However, as soon as I try and set up a cron job to run ProcessJobQueueTask (using the exact same command as in terminal), I get the following error:

Status: 302 Found
content-type: text/html; charset=utf-8
location: https://mydomain.org.nz/Security/login?BackURL=dev%2Ftasks%2FProcessJobQueueTask
vary: X-Forwarded-Protocol
cache-control: no-cache, no-store, must-revalidate

It would appear that I need to be logged in to run StaticPublishQueue?? How do I get around this to build static pages on a live site? Does a login and password need to be passed in the command? If so, how?

The fact that you’re getting a 302 and a bunch of response headers suggests that you’re trying to do this using an HTTP request.

What does your actual cron entry look like?