• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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