Cron Jobs: Difference between revisions

No edit summary
m Update to note Morty accounts could be charged overages
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Cron Jobs =
== Cron Jobs ==


In [[:Plesk|Plesk]], cron jobs are called `Scheduled Tasks`.
In [[:Plesk|Plesk]], cron jobs are called 'Scheduled Tasks'.


= Cron Jobs Affect Account Load =
== Cron Jobs Affect Account Load ==


{{Caution|
{{Caution|
Scheduled Tasks count towards your total account load. This means that running too many cron jobs or starting a cron job to run every 1 minute risks your account getting [[:Suspension_Policy#Cron_Jobs_/_Scheduled_Tasks|suspended for high server usage]].
Scheduled Tasks count towards your total account load. This means that running too many cron jobs or starting a cron job to run every 1 minute risks your account getting [[:Suspension_Policy#Cron_Jobs_/_Scheduled_Tasks|suspended for high server usage]] on [[:Tommy|Tommy]] and [[:Johnny|Johnny]], or charged for overages on [[:Morty|Morty]].
}}
}}


= Setting up a Scheduled Task =
== Setting up a Scheduled Task ==


To access the cron job section, navigate to:   
To access the cron job section, navigate to:   


'''Login > Plesk > Websites & Domains > [ domain ] > Scheduled Tasks > `Add Task`'''
'''Login > Plesk > Websites & Domains > [ domain ] > Scheduled Tasks > 'Add Task''''


[[File:plesk-scheduled-tasks.png]]
[[File:plesk-scheduled-tasks.png]]


= Cron Jobs are chrooted =
== Cron Jobs are chrooted ==


{{Info|
{{Info|
Line 25: Line 25:
}}
}}


= Working Around the chroot =
== Working Around the chroot ==


Some options to work around the chroot environment when setting up a Scheduled Task include:   
Some options to work around the chroot environment when setting up a Scheduled Task include:   


= Flask Endpoint =
== Flask Endpoint ==


Set up a Flask application and create an endpoint like `domain.helioho.st/update`, then use the "Fetch a URL" option inside Scheduled Tasks to access it via `https`.
Set up a Flask application and create an endpoint like 'domain.helioho.st/update', then use the "Fetch a URL" option inside Scheduled Tasks to access it via 'https'.


If you're new to Flask or want a more detailed guide, check out this [[:Flask|Flask tutorial]] to help you get started.
If you're new to Flask or want a more detailed guide, check out this [[:Flask|Flask tutorial]] to help you get started.


= Python =
== Python ==


Set up a Python script in the `cgi-bin` directory, then use the "Fetch a URL" option inside Scheduled Tasks to access the file via `https`.
Set up a Python script in the 'cgi-bin' directory, then use the "Fetch a URL" option inside Scheduled Tasks to access the file via 'https'.


If you're new to Python or want a more detailed guide, check out this [[:Python|Python tutorial]] to help you get started.
If you're new to Python or want a more detailed guide, check out this [[:Python|Python tutorial]] to help you get started.


[[File:plesk-schedule-a-task.png]]
[[File:plesk-schedule-a-task.png]]

Latest revision as of 18:47, 17 January 2025

Cron Jobs

In Plesk, cron jobs are called 'Scheduled Tasks'.

Cron Jobs Affect Account Load

Scheduled Tasks count towards your total account load. This means that running too many cron jobs or starting a cron job to run every 1 minute risks your account getting suspended for high server usage on Tommy and Johnny, or charged for overages on Morty.

Setting up a Scheduled Task

To access the cron job section, navigate to:

Login > Plesk > Websites & Domains > [ domain ] > Scheduled Tasks > 'Add Task'

Cron Jobs are chrooted

Scheduled Tasks run in a chroot environment with limited access to binaries and executables for security reasons.

This means you cannot directly access certain programs or scripts outside of your home directory.

Working Around the chroot

Some options to work around the chroot environment when setting up a Scheduled Task include:

Flask Endpoint

Set up a Flask application and create an endpoint like 'domain.helioho.st/update', then use the "Fetch a URL" option inside Scheduled Tasks to access it via 'https'.

If you're new to Flask or want a more detailed guide, check out this Flask tutorial to help you get started.

Python

Set up a Python script in the 'cgi-bin' directory, then use the "Fetch a URL" option inside Scheduled Tasks to access the file via 'https'.

If you're new to Python or want a more detailed guide, check out this Python tutorial to help you get started.


This page was last edited on 17 January 2025, at 18:47.