🔹 Cron Jobs

Cron Jobs allow you to automate tasks on your hosting account by running scripts at scheduled times. They are commonly used for maintenance, backups, and automation.

⏰ What Are Cron Jobs?

A Cron Job is a scheduled task that runs automatically at a specific time or interval on the server.

In simple words:
👉 Instead of manually running a task again and again, cron jobs do it for you.

Examples

  • Running WordPress scheduled tasks

  • Sending automated emails

  • Cleaning old files

  • Running backup scripts

  • Updating databases

⚙️ Setting Up Scheduled Tasks (Cron Jobs)

How to Create a Cron Job in Plesk

  1. Log in to Plesk

  2. Go to Websites & Domains

  3. Select your domain

  4. Click Scheduled Tasks

  5. Click Add Task

  6. Choose:

    • Command to run

    • Schedule (daily, hourly, weekly, custom)

  7. Save the task

📌 Tip: Use absolute paths for files to avoid execution errors.

🧩 Common Cron Job Use Cases

WordPress Cron

php /var/www/vhosts/yourdomain.com/httpdocs/wp-cron.php

Clear Cache Automatically

  • Clear cache files at midnight

  • Improve website performance

Backup Automation

  • Schedule database or file backups

  • Useful for large or dynamic websites

Email Automation

  • Send reports or notifications

  • Process contact form data

E-commerce Tasks

  • Order cleanup

  • Stock sync

  • Subscription renewals

⚠️ Best Practices for Cron Jobs

  • Test scripts manually before scheduling

  • Avoid running heavy tasks too frequently

  • Monitor logs for errors

  • Disable unused cron jobs

  • Use the proper PHP version if required

❗ Common Cron Job Issues

  • Wrong file path

  • Incorrect PHP version

  • Permission denied errors

  • Script timeout issues

📌 If a cron job fails, always check Plesk logs or enable script logging.