Applicable to:
- Plesk for Linux
Symptoms
-
When executing a scheduled task that runs a command to execute a script, it returns a Permission denied error:
PLESK_ERROR: Task " php -q /var/www/vhosts/example.com/httpdocs/wp-cron.php" completed with error in 0 seconds, output:
-: php: command not foundOr:
PLESK_ERROR: Task " php -q /var/www/vhosts/example.com/httpdocs/wp-cron.php" completed with error in 0 seconds, output:
-: /dev/null: Permission denied -
In
/var/log/plesk/panel.log
, the following entries may be seen with the debug enabled when the task is executed:CONFIG_TEXT: DEBUG [util_exec] [64f647aa435003f3d8e65caf25af2807-0] Starting: cron_task_executor -u root -c /var/www/vhosts/example.com/httpdocs/test.sh > /dev/null, stdin:
DEBUG [util_exec] [64f647aa435003f3d8e65caf25af2807-0] Finished in 0.09011s, Error code: 126, stdout: , stderr: /bin/sh: /path/to/executable/file.sh: Permission denied
ERR [panel] Task failed: id=726, pid=3245, type=scheduler-run-task, error=Scheduled task failed
DEBUG [panel] PleskUserException: Scheduled task failed
file: /usr/local/psa/admin/plib/Scheduler/RunTask.php -
The script
/path/to/executable/file.sh
executed by the task, does not have permissions to be executed:# ls -las /var/www/vhosts/example.com/httpdocs/test.sh
4 -rw-r--r-- 1 root root 1836 Mar 6 23:30 /var/www/vhosts/example.com/httpdocs/test.sh
Cause
Lack of permissions on the script file or missing command in the chroot environment.
Resolution
-
Change the shell for the subscription /bin/bash in Subscriptions > example.com > Web Hosting Settings > Access to the server over SSH.
Note: The next step is not necessary in case the executable file cannot be accessed via Plesk File manager.
-
Correct permissions or task type.
Comments
0 comments
Please sign in to leave a comment.