• 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.

Resolved Run cron task command with arguments

eliamarsura

Basic Pleskian
Hi
I create a script with bash that's need some arguments

I try to schedule this on plesk panel but it is executed without arguments.

The command look like this:
bash /root/myscript.sh argument1 argument2 argument3

If I execute the script from shell everything work fine (argument1 become $1 and so on), but if I put this inside Scheduled Tasks (Cron jobs) in plesk it doesn't read the arguments.
 

Attachments

  • Immagine 2022-02-21 234640.jpg
    Immagine 2022-02-21 234640.jpg
    25.2 KB · Views: 31
If I am not mistaken you don't have to prepend the command with bash. Just /root/myscript.sh argument1 argument2 argument3 should work.
 
Sorry to hear it didn't work. Did you try to output the results of the cronjob to a log file for debugging/analysis purposes?
 
Sorry, I meant that you output the content of your script to a file to log for your own debugging purposes.

I've created a quick bash script for testing. For me using arguments in the cronjob seem to work fine.

Bash:
#!/bin/bash
# Set script permission: chmod +x argument.test.sh

echo "Argument: "${1}

My cronjob settings look like this:
Schermafbeelding 2022-02-22 om 21.21.27.png

This outputs: Argument: hello
 
Last edited:
Finally I found the solution!
The problem wasn't the arguments but the plesk command

I had to use
/usr/sbin/plesk ext sslit --certificate -issue -domain $1 -registrationEmail $2 -secure-domain -secure-mail -secure-webmail -wildcard

instead of
plesk bin ext sslit --certificate -issue -domain $1 -registrationEmail $2 -secure-domain -secure-mail -secure-webmail -wildcard

If I use "plesk bin" directly on command line it's work, but it doesn't work if I pass trough cronjob
 
Back
Top