• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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