• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.

Issue Scheduled tasks that made via bash script showed incorrectly in the UI

YarDStaff

New Pleskian
I made a bash script that will create cron jobs in the crontab file.

A bit details: bash script creates type of cron "Run a PHP script" which means that we have script path and arguments if required. Also it is necessary to select the php version in the UI.

The issues I noticed:

1) script arguments that were made by my script are always quoted. Not big deal, but looks confusing, especially if we compare with crons that were made under the UI.

2) the php version is correct in the crontab, but incorrect in the UI. After some tests I can confirm that script runs correctly, but if we click on "save" under the UI - it will break everything(because incorrect version is selected in the UI). Screenshots are attached.
 

Attachments

  • image_2024-05-21_16-59-32.png
    image_2024-05-21_16-59-32.png
    3.1 KB · Views: 9
  • photo_2024-05-21_16-59-49 (2).jpg
    photo_2024-05-21_16-59-49 (2).jpg
    9.1 KB · Views: 7
  • photo_2024-05-21_16-59-59.jpg
    photo_2024-05-21_16-59-59.jpg
    17.7 KB · Views: 9
What are the commands you're using in your Bash script to create these cronjobs?
 
I can't tell from your code whats exactly gets added to the contab. Which makes it hard to help you. Can post an single crontab command example so that could try to replicate your issue?

Also, a scheduler utility has been added to the Plesk CLI in Plesk version .61, which might be useful for you. It currently hasn't been added to the documentation yet. Running plesk bin scheduler --help will list the options.
 
I can't tell from your code whats exactly gets added to the contab. Which makes it hard to help you. Can post an single crontab command example so that could try to replicate your issue?

Also, a scheduler utility has been added to the Plesk CLI in Plesk version .61, which might be useful for you. It currently hasn't been added to the documentation yet. Running plesk bin scheduler --help will list the options.
Unfortunately we have .60 version, so this command is not valid for me yet.

Here is the simple code snippet for you to run on your environment.

Bash:
#!/bin/bash
temp_cron_file=$(mktemp)
cron_job="15 3 * * * /opt/plesk/php/7.1/bin/php -f 'httpdocs/public/cron.php' -- 'test'"
crontab -l > "$temp_cron_file" 2>/dev/null
echo "$cron_job" >> "$temp_cron_file"
crontab "$temp_cron_file"
rm "$temp_cron_file"
 
The quoted argument is a mystery to me too. But I can't replicate the issue with the selected PHP version as you described. My guess would that it's caused because the PHP version is not installed or available to the service plan. But if you want to know for sure I recommend to contact Plesk support for an investigation of the issue.
 
The quoted argument is a mystery to me too. But I can't replicate the issue with the selected PHP version as you described. My guess would that it's caused because the PHP version is not installed or available to the service plan. But if you want to know for sure I recommend to contact Plesk support for an investigation of the issue.
I can confirm that the PHP version is exists. Screenshots are attached. Maybe the issue is because of we have a lot of them, but not only one. (Note: cron from screenshots is the one that was created under the UI, but not with bash script).

Great thanks, I appreciate your help. Will try to contact Plesk support.
 

Attachments

  • Screenshot from 2024-05-23 09-57-47.png
    Screenshot from 2024-05-23 09-57-47.png
    44.1 KB · Views: 1
  • Screenshot from 2024-05-23 09-58-06.png
    Screenshot from 2024-05-23 09-58-06.png
    3.6 KB · Views: 1
Back
Top