How to run static publish queue without having to login

Silverstripe Version: 4.13


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
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?

I ended up getting this working by using


instead of sake. I also had to specify which php version is being used on server via cPanel > MultiPHP Manager. Cron job ended up looking like:

*	*	*	*	*	/usr/local/bin/ea-php81 /home/username/ dev/tasks/ProcessJobQueueTask >/dev/null 2>&1

Hopefully this will help someone else in the future.

1 Like