Biblioteca de cunoștințe

knowledgebase

ypsilon.kb.documentation
Server & Hosting Management

Scheduling Tasks (Cron Jobs)

  • 7 Răspunsul a fost util?

Scheduled Tasks, commonly known as Cron Jobs on Linux, allow you to set up scripts or commands to run automatically on your server at specific intervals, such as every night at midnight or every 5 minutes.

Why Use Scheduled Tasks?

You can use scheduled tasks to automate routine maintenance for your web applications. Common uses include:

  • Triggering a caching plugin to clear and rebuild its cache.
  • Sending out daily batch emails or newsletters from your application logic.
  • Running database cleanup or custom backup scripts over night.

Creating a Scheduled Task in Plesk

  1. Go to Websites & Domains and click on Scheduled Tasks in the right-hand panel.
  2. Click Add Task.
  3. Select the Task Type:
    • Run a Command: Usually for executing bash or system level executables.
    • Fetch a URL: Plesk will use curl/wget to hit a specific web route that triggers a job in your app (like `/api/run-maintenance`).
    • Run a PHP script: Perfect for executing a script directly from the disk. Plesk lets you specify the exact PHP version to run it with!
  4. Set the Schedule: Pick how often it should run using the simple dropdown menus, or select "Cron style" to write your own advanced cron syntax (e.g. `*/15 * * * *` for every 15 minutes).
  5. Choose whether you want to receive an email notification if the script fails, and click OK.

Răspunsul a fost util?

Articole similare