twerple logo
Loading experience...
twerple logo

Setting up a cron job

1 min read • Updated 2 weeks ago • Websites, PHP & Performance

Run a script or URL automatically on a schedule, with ready-made command examples.


A cron job runs a command automatically on a schedule, for example a nightly import, sending queued emails or running WordPress's scheduled tasks reliably. How many cron jobs you can create depends on your plan.

Creating a cron job

  1. Sign in to HostPanel and go to Tools → Cron Jobs.
  2. Create a new job and choose the Domain it belongs to. The insert-path helper can fill in your website's folder for you.
  3. Give it a Task name.
  4. Enter the Command (examples below).
  5. Choose a Schedule: a preset such as every 5 minutes, hourly or daily at 2am, or switch to Advanced to enter the minute, hour, day, month and weekday yourself.
  6. Save.

You can also manage cron jobs on the Cron Jobs tab of your hosting in the client area.

Command examples

Replace USERNAME and example.com with your own.

# Run a PHP script
php /home/USERNAME/example.com/public_html/cron.php

# Open a web address
curl -s https://example.com/cron/run > /dev/null

# Run WordPress's scheduled tasks
cd /home/USERNAME/example.com/public_html && wp cron event run --due-now

# Laravel scheduler (every minute)
cd /home/USERNAME/example.com && php artisan schedule:run

Checking that it works

  • Click Run now to test the job straight away.
  • Click View logs to see each run's output, exit code and duration.
  • Jobs that fail three or more times in 24 hours are highlighted. Check their logs.

Use the switch to pause a job, and delete jobs you no longer need.

For security, cron jobs can only run your own files and common tools such as PHP, Python, Node, curl, wp and composer.

Was this article helpful?