• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    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.

Question Is my scheduled task right?

immc

New Pleskian
Server operating system version
Ubuntu 24.04.2 LTS
Plesk version and microupdate number
Plesk Obsidian 18.0.70 Web Host Edition
I'm trying to install an app that checks the cron job as one of the last steps of the installation process. If the cron job is incorrect it throws a Fail error stating that the cron job isn't activated. From the app:

Cron job is not activated yet. Please use your server management platform to create a cron job that runs following command every minute.

Sample Cron Job:
php -f /var/www/vhosts/mydomain.com/httpdocs/api/admin.php bof_cronjobs=yes
or
php -f /var/www/vhosts/mydomain.com/httpdocs/api/app.cronjob.php

Task Type: Run a command or Run a PHP script. I've tried both.
Use PHP version: 8.3.21.
Run: Cron style: * * * * *

If I hit Run Now I get either of the following:

Task "php -f /var/www/vhosts/mydomain.com/httpdocs/api/admin.php bof_cronjobs=yes" completed with error in 0 seconds, output:

PHP Warning: Module "curl" is already loaded in Unknown on line 0
Could not open input file: php -f /var/www/vhosts/mydomain.com/httpdocs/api/admin.php bof_cronjobs=yes

or

If I use: Script Path: php -f /var/www/vhosts/mydomain.com/httpdocs/api/app.cronjob.php

I get:

Task "php -f /var/www/vhosts/mydomain.com/httpdocs/api/app/admin/cronjob.php" completed with error in 0 seconds, output:

Could not open input file: php -f /var/www/vhosts/mydomain.com/httpdocs/api/app/admin/cronjob.php


I gotta be doing some wrong. What am I missing? Any guidance is appreciated.
 
Are you making the task at the domain level or system level? If under domain level then the task is run at the user path level set by the home directory so the path for running a PHP script should be more like httpdocs/api/app/admin/cronjob.php and you can just choose to run a php script (when you choose to run a php script an option to browse to the file in question will be available so it makes it easier).
1749186240970.png

You can refer to Scheduling Tasks for properly creating scheduled tasks, you can also refer to https://support.plesk.com/hc/en-us/...uled-Tasks-in-Plesk-Could-not-open-input-file if you want but it'll just redirect you back to that first link lol.
 
This is being ran at the domain level.

Resolution:
- I needed to remove the php -f.
- I also failed to add arguments to the arguments field.

Result:
- Task Type: Run a PHP script.
- Script Path: /var/www/vhosts/mydomain.com/httpdocs/api/admin.php with arguments: bof_cronjobs=yes
- Use PHP Version: 8.3.21
- Run: Cron style * * * * *
- Resolved!

Links bookmarked for future reference. Thanks for the response.
 
Back
Top