• 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.

Resolved Run plesk command as cronjob not working

Azurel

Silver Pleskian
EDIT: Solution is not to use "plesk bin <command>" and use instead "/usr/local/psa/bin/<command>" in cronjob.


I have created a php command-line script with command
Code:
shell_exec('plesk bin <command>');

As root in shell with putty that line is working!
Code:
# /opt/plesk/php/7.4/bin/php /var/www/vhosts/example.com/myscript.php

I added it as cronjob (every minute) /etc/cron.d/myscript with this line
Code:
*/1 * * * * root /opt/plesk/php/7.4/bin/php /var/www/vhosts/example.com/myscript.php

Now I get a cron mail with
sh: plesk: command not found

What am I missing here?
 
Last edited:
It's been more than one year but since it remains unanswered, I will reply to this old topic.

I had the same problem and didn't find anything which even mentioned this specific problem but only this topic. So I dug a little more and saw the KB article which told Plesk command line utilities could be run stand alone, without the plesk command itself. So instead of this:

PHP:
shell_exec('plesk bin <command>');
you should be using this:
PHP:
shell_exec('/usr/local/psa/bin/<command>');

For example if you want to run domain utility. Instead of this:

PHP:
shell_exec('plesk domain --do --something');
you need to run it with the full path of the "domain" utility like:
PHP:
shell_exec('/usr/local/psa/bin/domain --do --something');

P.S. You need to change the path accordingly if you are running on Windows. Like;
Code:
C:\\Program Files (x86)\\Parallels\\Plesk\\bin\\domain.exe
 
Thanks. Thats nice of you, however the answer is already in start post. See first line. ;)
 
Back
Top