• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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