• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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