cPanel

How to Run Remote Scripts from cPanel Cron

Cron jobs let you automatically run scripts at scheduled times — ideal for performing regular tasks such as data imports, backups, or system updates.

This guide explains how to run remote scripts (for example, PHP scripts hosted on your website or another domain) using cPanel Cron Jobs in your Ecenica hosting account.

Step 1. Access cPanel Cron Jobs

  1. Log in to your Ecenica Dashboard
  2. Click My Services > Hosting
  3. Click Cron Jobs under the Websites section.

This cron scheduler provides an easy way to manage automated scripts without needing to edit configuration files manually.

Step 2. Use cURL or Wget to Run Remote Scripts

You can trigger a remote script using either cURL or Wget.

Both commands make a web request to your script’s URL, ensuring PHP and other server-side code run correctly on the destination server.

Using cURL:

/usr/bin/curl -s https://www.example.com/crons/your-script.php >/dev/null 2>&1

Using Wget:

/usr/bin/wget -q -O - https://www.example.com/crons/your-script.php >/dev/null 2>&1

Both examples suppress output (>/dev/null 2>&1) to prevent unnecessary emails from each cron execution.

Step 3. Test Before Automating

Before scheduling your cron job, confirm your script runs correctly.

You can do this by:

  • Running it in your web browser:
    Visit the URL directly, e.g. https://www.example.com/crons/your-script.php

  • Running it manually in your terminal or via SSH:
    Use the same curl or wget command to confirm it executes successfully.

If the script completes without error, it’s ready to be automated in cPanel.

Step 4. (Optional) Log or Email Output

For debugging or verification, you can log cron output to a file or receive it by email.

Log output to a file:

/usr/bin/curl -s https://www.example.com/crons/your-script.php >> /home/username/cron_logs/your-script.log 2>&1

Email output:
Remove the >/dev/null 2>&1 part of your command.
cPanel will automatically email the output to the address specified in the Cron Email field at the top of the Cron Jobs page.

Step 5. Confirm the Cron Is Running

Once scheduled, check your cron job logs or monitor your script’s expected results (e.g. updates, reports, or database changes) to confirm it’s running as planned.

Need Help?

If you’d like assistance creating or testing your cron jobs, please contact Ecenica Support. Our team will be happy to help you get everything running smoothly.

Was this guide helpful?

Need help with this?

Open a ticket and link to this guide so our team can see what you have tried.

View support tickets

Power your business with Ecenica Hosting

Built for WordPress and serious websites. Fast, secure and supported by real people in the UK.

Ecenica hosting services represented by a connected red route across London