• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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