A scheduled task set up to run from under a subscription user fails:

Started by mahesh, May 04, 2024, 07:17 AM

Previous topic - Next topic

mahesh

Question: A scheduled task set up to run from under a subscription user fails: No such file or directory
Symptoms
Access to the server over shell is set to Forbidden or chrooted for subscription user in Domains > example.com > Hosting & DNS > Web Hosting Access

A scheduled task set up to run from under a subscription user fails with one of the following error messages:

Task /opt/plesk/php/5.6/bin/php -q /var/www/vhosts/example.com/wp-cron.php completed with error in 0 seconds, output:
-: /opt/plesk/php/5.6/bin/php: No such file or directory


user with id=11112 and name=`<user_name>` not found in chrooted passwd file
system error: No such file or directory


/var/www/vhosts/example.com/httpdocs/app/cake: /usr/bin/env: bad interpreter: No such file or directory

Task "php -q /var/www/vhosts/example.com/crons/cron.php" successfully completed in 0 seconds, output:
The file /var/www/vhosts/example.com/crons/cron.php is corrupted.


Task "wget --spider -O - https://example.com/api_provider/cron/order >/dev/null 2>&1" completed with error in 0 seconds.

Cause
System utilities (curl, wget, php, etc.) are not accessible for the subscription user.

Resolution
One of the following workarounds may be applied:

1.Recreate the task from under a root user at Tools & Settings > Scheduled Tasks:

Task type: Run a command
Command: /opt/plesk/php/7.2/bin/php -q /var/www/vhosts/example.com/httpdocs/whmcs/crons/cron.php

OR
Task type: Run a PHP script
Script path: /var/www/vhosts/example.com/httpdocs/whmcs/crons/cron.php
Use PHP version: select any required version
System user: root

2.Provide the system user john_doe with access to the server over SSH (for example, /bin/bash) at Domains > example.com > Web Hosting Access.

3.Change the crontab shell for scheduled tasks to /bin/bash at Tools & Settings > Scheduled Tasks > Settings.

4.Add a required command to chrooted environment.