• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question What's the right syntax for script options in Scheduled Tasks?

Dengro

New Pleskian
Server operating system version
CentOS?
Plesk version and microupdate number
Plesk Obsidian?
Dear all, I'm using the restricted version of Plesk Obsidian that my provider has made available to me. It comes with Scheduled Tasks, which I use on a regular basis to keep my sites and their database in good health. Unfortunately, I don't have shell access and can't inspect the full logs to see what happens when scripts are run.

My question is about the correct syntax for the arguments to "Run a PHP script", especially the long option, with the double dash prefix. To prevent one of the scripts from running for days and creating overhead, I attach a couple of options, but it doesn't always look like they are honoured. For instance, to prevent it from running over 1500 seconds, I tried:

--maxtime="1500"
--maxtime=1500

But after 12 hours, it's still running. I couldn't find anything specific about the expected syntax
- Should I use an equals signs or none at all?
- Should I use single quotes or double quotes or none at all?
- Should there also be single quotes to wrap each option, e.g. '--maxtime=1500' ?

Maybe someone could enlighten me?
 
Is it not the case that it depends on the specific PHP script you're running? The scripts I'm running come with their own particular options/flags.
 
Is it not the case that it depends on the specific PHP script you're running? The scripts I'm running come with their own particular options/flags.
Right, those would be regular script 'arguments', which can be defined separately in Plesk when creating a Scheduled Task (cron job).

I would depend on your script how those arguments are handled and used. By itself the --maxtime="1500" or --maxtime=1500 argument does nothing in PHP. They are just script arguments, not a PHP option. You could of course use the argument value to set the max_execution_time of the PHP script for example.

Quick side note, I forgot you can't actually can't use any PHP command line options when using the "Run a PHP script" methode for a cron job in Plesk as suggested in my previous post.
 
> Right, those would be regular script 'arguments', which can be defined separately in Plesk when creating a Scheduled Task (cron job).
> By itself the --maxtime="1500" or --maxtime=1500 argument does nothing in PHP

I am passing the script arguments to the "with arguments" field. Is that incorrect?

> I would depend on your script how those arguments are handled and used.

Thanks! I had two working assumption, both of them mistaken it now seems. The first is that perhaps Plesk would run those arguments through an interpreter and the second is that in turn, the script might depend on whatever syntax it is the operating system works with for command line options - equal signs, double quotes or single quotes, etc. So it's all up to the script. That gives me something to work with.
 
> Right, those would be regular script 'arguments', which can be defined separately in Plesk when creating a Scheduled Task (cron job).
> By itself the --maxtime="1500" or --maxtime=1500 argument does nothing in PHP

I am passing the script arguments to the "with arguments" field. Is that incorrect?
No, that's what you're suppose to do :)

> I would depend on your script how those arguments are handled and used.

Thanks! I had two working assumption, both of them mistaken it now seems. The first is that perhaps Plesk would run those arguments through an interpreter and the second is that in turn, the script might depend on whatever syntax it is the operating system works with for command line options - equal signs, double quotes or single quotes, etc. So it's all up to the script. That gives me something to work with.
It is indeed all up to your script.
 
Thanks! It's odd that this sort of thing isn't more standardised, especially since documentation often only lists the options you can use, with what values, but omits info on details of syntax.

Anyway, that's enough from me.
 
Back
Top