• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Question Which Shell Should be used for Cronjobs?

MHC_1

Regular Pleskian
Server operating system version
alma linux 9.7
Plesk version and microupdate number
18.0.76#4
As you may be aware, cronjobs on Plesk are a mess. I am trying to work out how to run Cron PHP scripts. I have numerous issues previously mentioned on this forum with some mixed results and some badly long winded solutions to the way Plesk chooses to deal with Cronjobs .

Anyways, some cronjobs work ok. Others do not. No cron jobs ever work from the Plesk scheduled task GUI.

I am looking into the
Code:
/var/logs/cron
file and seeing references to
Code:
/var/spool/cron/<account>
. Within these I see multiple cron commands but they HAVE DIFFERENT SHELLS.
MAILTO="[email protected]"
SHELL="/bin/sh"
#@desc: CalProcessing
<line removed as can't post to forum>

MAILTO="[email protected]"
SHELL="/usr/local/psa/bin/chrootsh"
#@desc: Cal Processing 2
<line removed as can't post to forum>

So; both of these shells are present and both of these Cronjobs are present but I can't confirm either of these Crons work in the wild.

WHICH SHELL IS MORE LIKELY TO SUCCEED?

WHY ARE THEY DIFFERENT?
 
Hi, @MHC_1 . Could you please double-check if the cron with the /bin/sh is configured as "Fetch a URL" type? If yes, this is an expected behavior as the "Fetch a URL" scheduled tasks always use the /bin/sh shell.
 
Hi, @MHC_1 . Could you please double-check if the cron with the /bin/sh is configured as "Fetch a URL" type? If yes, this is an expected behavior as the "Fetch a URL" scheduled tasks always use the /bin/sh shell.
Hello
Thanks for getting back to me. None of our cronjobs use fetch URL, they're always "Run command" or "Run PHP Script" .

Also further rumination on this I wonder perhaps the different Shell is from setting the Cronjob in the Admin level rather than the Account or Subscription level? Either way, Which Shell should be used?
 
By default, the shell defined in Tools & Settings > Scheduled Tasks (Cron jobs) > Settings is used. However, that could be overridden on a subscription level from Subscriptions > example.com > Hosting & DNS > Hosting > SSH access. Could you please double-check the list of tasks in the account corresponding to the user in /var/spool/cron/<account> from Subscriptions > example.com > Dashboard > Scheduled Tasks, as well as the shell defined for the subscription (if any)?
 
By default, the shell defined in Tools & Settings > Scheduled Tasks (Cron jobs) > Settings is used. However, that could be overridden on a subscription level from Subscriptions > example.com > Hosting & DNS > Hosting > SSH access. Could you please double-check the list of tasks in the account corresponding to the user in /var/spool/cron/<account> from Subscriptions > example.com > Dashboard > Scheduled Tasks, as well as the shell defined for the subscription (if any)?
Thank you for this.

I hadn't realised that the SSH Access also impacts the Cronjob system. Is this documented anywhere?

And so back to the original question -- the account SSH access from external devices will always be chrooted access type. How does this impact scripts (PHP mostly but also possibly Perl scripts) running on the account? The PHP on the account's cron job already doesn't use the account PHP settings (per numerous other posts in recent months on this). So worth asking specifically how this impacts? Cheers
 
You are welcome. I am linking the docs:
And so back to the original question -- the account SSH access from external devices will always be chrooted access type. How does this impact scripts (PHP mostly but also possibly Perl scripts) running on the account? The PHP on the account's cron job already doesn't use the account PHP settings (per numerous other posts in recent months on this). So worth asking specifically how this impacts?

I am afraid, I am not quite sure I got this part of the question. Sorry. When you configure a "Run a PHP script" type of a cron, you get a dropdown you can select the PHP version from. If the cron is configured as "Run a command", unless you specify the full path to the desired PHP version's binary, the php command calls the binary installed by the PHP version provided by the operating system repository. Or do you mean that the scheduled tasks you have configured intentionally use a different PHP version?
 
Back
Top