Skip to main content
MagicPost runs all of its background work from the Laravel scheduler. A single cron job that starts the scheduler every minute is enough to publish posts, renew channel tokens, deliver webhooks, read feeds and more. If it does not run, scheduled posts simply stop going out.
Without the cron job nothing is published. Add it as soon as the install finishes.

The cron command

MagicPost builds the exact command for your server, with the application path and the PHP binary it found. You can copy it from two places:
  • The last screen of the web installer, under One last step: add the cron job.
  • Admin → Publishing → Settings, in the Sending card, next to Cron job. Click Copy for the command alone, or Copy the crontab line for the full line.
The crontab line looks like this. Your path and PHP binary will differ, so copy yours from the application.
Under PHP-FPM or LiteSpeed the web server’s PHP is not the command-line PHP. MagicPost uses the command-line php from the same PHP installation when it can find one, and plain php otherwise. If the command it shows does not run, ask your host for the path of the command-line PHP and use that instead.

Add the cron job

1

Open Cron Jobs

In cPanel, open Cron Jobs in the Advanced section.
cPanel Advanced section with Cron Jobs highlighted

Cron Jobs in the Advanced section of cPanel

2

Choose the interval

Under Add New Cron Job, open Common Settings and choose Once Per Minute. If your cPanel has no such option, type * in each of the Minute, Hour, Day, Month and Weekday fields.
3

Paste the command

Paste the command from MagicPost into the Command field and click Add New Cron Job.
If your host only allows a five-minute interval, the cron job still works, but posts go out up to five minutes late. System health treats the cron job as stopped when the last run is more than five minutes old, so with a five-minute interval it can flag the job between runs.

What the scheduler runs

Every task runs inside the schedule:run process, so the scheduler does not need proc_open. Tasks that overlap themselves are guarded with cache locks, which is why System health warns when CACHE_STORE is array or null.

Cron mode and worker mode

Under Admin → Publishing → Settings, the Sending card has a Posts are sent by choice.
The default, for hosts that only offer cron. Every minute, the two publishing:work lanes process queued jobs for the number of seconds set in Each pass sends for. The value must be between 10 and 55 seconds, and the default is 45, so a pass ends before the next one begins. Lower it if your host stops long cron jobs.
Both modes use the queue named by QUEUE_CONNECTION in .env, which defaults to database. System health reports the null driver as a problem, because it throws jobs away, and the sync driver as a warning, because each post would then be sent inside the request that queued it. Set QUEUE_CONNECTION=database unless you run another queue backend on purpose. Hand out at most on the same page limits how many posts are handed to the queue per minute. Posts due at the same moment beyond that limit go out over the following minutes. See Publishing settings for the retry, waiting and upload limits.

Check that it works

Open Admin → Publishing → Settings.
  • The Sending card shows Last ran with the time of the last scheduler run, or Has not run yet.
  • System health shows the Cron job line as passed, with the time of the last run. It fails with “The scheduler has never run” or “The scheduler last ran” when the last run is missing or more than five minutes old.
  • The Queue line reports jobs that have waited more than ten minutes, and says whether the cause is a missing worker or a slow scheduler.
  • Click Check again after you make a change.

Troubleshooting

The cron job is missing or its command is wrong. Check the path of the application and of the command-line PHP, and make sure the cron user can read the application folder.
Open System health and read the Queue, Waiting posts and Stalled sends lines. A channel that is paused, needs reconnecting, or belongs to a network that is switched off holds its due posts for up to the Wait for a channel for up to limit.
Set CACHE_STORE=database or CACHE_STORE=file in .env. The array and null stores forget everything between requests, so overlapping scheduler runs cannot be kept apart.
For more, see Scheduler and queue problems.