Default SHELL for cronjobs
Hi everyone!
I have a question for cPanel staff/developers: is the any way to define default shell (bash, sh, jaishell, etc.) for cPanel accounts cronjobs? I've found the following code in cPanel "Cron" module (/usr/local/cpanel/Cpanel/Cron/Edit.pm):
So please advise, can I use /var/cpanel/crontabshell file to specify default shell binary for cronjobs? Or maybe there is another way to do this. Thanks.
our $CRONTAB_SHELL_FILE = '/var/cpanel/crontabshell';# Allow admins to specify a default SHELL setting
if ( -e $CRONTAB_SHELL_FILE ) {
my $cron_shell_ref = Cpanel::Config::LoadConfig::loadConfig($CRONTAB_SHELL_FILE);
$cronshell = $cron_shell_ref->{'SHELL'};
}So please advise, can I use /var/cpanel/crontabshell file to specify default shell binary for cronjobs? Or maybe there is another way to do this. Thanks.
-
Hello :) Cron jobs are now run with jailshell. This is normal, and the intended behavior since cPanel 11.38. It's documented at: Jail System Update Is there a specific limitation on cron jobs that is causing issues with your scripts? Thank you. 0 -
If the cPanel account is set to use either jailshell, or noshell, then all cron jobs for that user will run using jailshell. If the cPanel account is set to use any other shell (e.g. zsh, bash, etc), then it is possible to use /var/cpanel/crontabshell to set the shell for the cronjobs. To do this, using zsh as an example: echo 'SHELL=/bin/zsh' > /var/cpanel/crontabshell'
Keep in mind the following: 1. The shell you specify in /var/cpanel/crontabshell must also be present in /etc/shells. 2. The cronjob shell will only change after the crontab is modified via the cPanel UI.0
Please sign in to leave a comment.
Comments
2 comments