• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Question Scheduled task error

nalayh

New Pleskian
Server operating system version
Debian 11.5
Plesk version and microupdate number
18.0.48
Hello. I hope someone can help me because I'm going crazy already.
I am trying to run in scheduled task for a domain, a script to automatically convert all images from jpg to webp. But I get different errors and I don't know how to do it anymore. It is a sh file, but I have seen that it is not recommended to use command execution with sh for security and that it is recommended to use php.
I am new to linux and as much as I have tried to execute the script in several ways, I always get errors.
The content of the script is the following and I have it located in the folder httpdocs/bin and it is called jpg2webp.sh

find ./httpdocs/img -type f -mtime -1 -name '*.jpg' -exec sh -c ' cwebp -q 90 $1 -o "${1%.jpg}.jpg.webp"' _ { {};

If I run the script in SSH command console it works correctly, but not when I try to run it via scheduled task. I think it is a routing problem but I can't find the solution.
I get this errors:

httpdocs/bin/jpg2webp.sh: line 5: /bin/find: No such file or directory

If I remove the /bin I can't find the find command:

httpdocs/bin/jpg2webp.sh: line 5: find: command not found

I would like to "convert" it to php but I don't know how to do it.
I hope your help and thank you very much in advance.


Best regards
 
Back
Top