Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to set up a task to be executed:
- every minute
- every 2 minutes
- every 5 minutes
- every 30 minutes
on a Plesk server?
Answer
The cron format for setting time of the task execution can be used.
-
Go to Tools & Settings > Scheduled Tasks, press the Add Task button to create a new task or click the already existing task.
-
Select the Cron style in the drop-down menu opposite the Run directive:
-
Specify the required time in the cron format:
Note: using the "/" character is not allowed in Windows.
Instead of this, it's required to place a comma-separated list for each execution time.
If you try to use the "/" character, the next error will appear:
"Invalid crontab syntax"Linux-
every minute:
CONFIG_TEXT: * * * * *
-
every 2 minutes:
CONFIG_TEXT: */2 * * * *
-
every 5 minutes:
CONFIG_TEXT: */5 * * * *
-
every 30 minutes:
CONFIG_TEXT: */30 * * * *
Windows-
every minute:
CONFIG_TEXT: * * * * *
-
every 2 minutes:
CONFIG_TEXT: 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *
-
every 5 minutes:
CONFIG_TEXT: 0,5,10,15,20,25,30,35,40,45,50,55 * * * *
-
every 30 minutes:
CONFIG_TEXT: 0,30 * * * *
-
Comments
5 comments
Hello! The example provided is not clear and only works because "every 30 minutes" is equivalent to two executions - at :00 and :30 of the hour. However, if you took this same command and wanted to edit it to every 2 minutes for example, somebody might try to use the cron-style (Windows): 0,2**** , but this is not correct. This would only run the task at :00 and :02 of the hour. To run a task every 2 minutes, you would need to use the following cron-style (Windows): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *
Can you please review this article and update it if necessary to clarify the correct format for every x minutes?
Thanks!
Hi @Chad Thornburg,
Indeed, using the "/" character is not allowed in Windows
Instead of this, it's required to place a comma-separated list for each execution time
If you try to use the "/" character, the next error will appear:
So, your examples are correct and I added them to the article. Thank you!
This was such a poorly thought out feature to implement and as such a bad one.
It's great that Plesk want's to standardise the control panel between platforms but now in the case of Windows servers the experience is worse than before. Previously there were checkboxes that you could tick, so if you wanted a task to execute every 5 minutes then you could just ticket the appropriate boxes.
Now in attempt to bring cron style to Windows without the / character this has become really laborious having to enter 0,5,10,15,20,25,30,35,40,45,50,55 * * * *. There should have been compensation for the / character in Windows and Plesk should have translated this behind the scenes instead of the user. Plesk on Windows should detect the / character, work out the increments, produce a comma separated list and use that, the user should be unaware of this.
So it's cron but not cron and as such Windows servers have a feature that's worse than and not as good as it was before.
Hello @Pere
Thank you for the feedback.
Feel free to share functionality suggestions at Plesk User Voice portal.
Hi.
Try to add record to crontab directly:
For example run command every minute:
#crontab -e
save crontab ane refresh Plesk crontabs. You'll see:
Please sign in to leave a comment.