• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • 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.

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