ISPConfig Cronjob with Jailkit: DOCROOT_CLIENT Variable & Chrooted Cron Issues

Discussion in 'Installation/Configuration' started by Sergio W., Jul 26, 2025.

  1. Sergio W.

    Sergio W. Member

    Hi everyone,

    I'm encountering some difficulties getting a cron job to run correctly on ISPConfig when Jailkit is enabled for the site. I'm trying to set up a Laravel schedule command, and it seems to work only with "Full Cron" but not with "Chrooted Cron."

    Here's a detailed breakdown of the problems I'm facing:

    1. DOCROOT_CLIENT Variable Issue:

    First, in my Jailkit environment, the {DOCROOT_CLIENT} variable doesn't seem to be resolving correctly. In my cron.log, I'm seeing the following PHP warning:

    Code:
    PHP Warning: Undefined variable $web_docroot_client in /usr/local/ispconfig/server/plugins-available/cron_plugin.inc.php on line 308
    This suggests that the variable isn't being properly defined or passed when cron jobs are executed in the Jailkit context. Is this a known bug with ISPConfig and Jailkit, or could it be a misconfiguration on my end?

    I also tryed with /usr/bin/php and /var/www/ , /var/www/clients/clientX/webX/web/artisan schedule:run and /web/artisan schedule:run with no luck.

    2. Jailkit Cron Chrooted Applications Configuration:

    I've checked the "Jailkit cron chrooted applications" setting, and it's currently configured as:
    Code:
    /usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php /usr/bin/php
    Is this configuration correct and sufficient for running PHP-based cron jobs within the chroot environment? Specifically, is it correctly handling the paths for PHP?

    3. Laravel Cron Job and Chrooted Execution:

    I'm trying to set up a standard Laravel schedule run command. The command I'm using for the cron job is:

    {SITE_PHP} -q {DOCROOT_CLIENT}/artisan schedule:run

    This command works perfectly when the cron job is set to "Full Cron." However, when I switch the setting to "Chrooted Cron," it fails to execute. This strongly suggests an issue with how the command or its environment is being handled within the Jailkit chroot.

    My main question is: What modifications or changes do I need to make to ensure this command executes correctly when the cron job is set to "Chrooted Cron"?

    Any insights, debugging tips, or recommended configuration adjustments for DOCROOT_CLIENT or Jailkit setup would be greatly appreciated!

    Thanks in advance for your help.
     
  2. michelangelo

    michelangelo Active Member

    Which ISPConfig version are you using and with what PHP version does ISPConfig run with?

    From where does the "Jailkit cron chrooted applications" come from? Is that the configuration of the webspace or does that come from the server configuration? Actually it is sufficient to go with the ISPConfig defaults from the server configuration. If you, for whatever reason, need to overwrite these settings via the webspace jailkit configuration, then you must make sure to insert the correct jailkit sections as well.

    You say "Full cron" works, so I guess you've correctly configured the PHP-CLI settings of the PHP version that you've assigned to the webspace? This is a mandatory step, otherwise the placeholders won't work correctly.
     
  3. Sergio W.

    Sergio W. Member

    Hi,

    Thanks for the quick reply and the insightful questions!

    I'm running ISPConfig 3.3.0p2 on Ubuntu 24.04, so the default PHP version for ISPConfig itself is PHP 8.3.

    Regarding the "Jailkit cron chrooted applications" setting, I haven't modified it. It's currently using the ISPConfig defaults from the server configuration. Given that, what specific changes or additions should I be looking for or making to ensure the correct functioning of PHP within the chroot environment for cron jobs?

    Yes, "Full Cron" works perfectly, confirming that the PHP-CLI settings for the PHP version assigned to the webspace are indeed configured correctly. The issue seems isolated to the chrooted environment.

    Thanks again for your help!
     
  4. michelangelo

    michelangelo Active Member

  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the generated cron file. It's in /etc/cron.d/ folder
     
  6. Sergio W.

    Sergio W. Member

    Hi @till
    This is my cron file:


    Code:
    MAILTO=''
    SHELL='/usr/sbin/jk_chrootsh'
    
    */5     *       *       *       *       web1  /usr/bin/php -q /web/artisan schedule:run  #domain.com
    in /var/log/ispconfig/cron.log I have:

    Code:
    gio 31 lug 2025, 12:02:01, CEST PHP Deprecated:  Creation of dynamic property cron_jailkit_plugin::$data is deprecated in /usr/local/ispconfig/server/plugins-available/cron_jailkit_plugin.inc.php on line 112
    gio 31 lug 2025, 12:02:01, CEST PHP Deprecated:  Creation of dynamic property cron_jailkit_plugin::$jailkit_config is deprecated in /usr/local/ispconfig/server/plugins-available/cron_jailkit_plugin.inc.php on line 113
    gio 31 lug 2025, 12:02:01, CEST PHP Warning:  Undefined variable $options in /usr/local/ispconfig/server/plugins-available/cron_jailkit_plugin.inc.php on line 312
    gio 31 lug 2025, 12:02:36, CEST PHP Warning:  Undefined variable $options in /usr/local/ispconfig/server/plugins-available/cron_jailkit_plugin.inc.php on line 315
    gio 31 lug 2025, 12:02:39, CEST usermod: user web1 is currently used by process 3517663
    gio 31 lug 2025, 12:02:39, CEST failed to execute usermod -d /var/www/clients/client1/web1/. -s /usr/sbin/jk_chrootsh web1
    gio 31 lug 2025, 12:02:39, CEST failed to modify user web1
    gio 31 lug 2025, 12:02:39, CEST setquota: Not setting block grace time on /dev/sda1 because softlimit is not exceeded.
    gio 31 lug 2025, 12:02:39, CEST setquota: Not setting inode grace time on /dev/sda1 because softlimit is not exceeded.
    gio 31 lug 2025, 12:02:39, CEST PHP Warning:  Undefined variable $web_docroot_client in /usr/local/ispconfig/server/plugins-available/cron_plugin.inc.php on line 308
    
    Thanks!
     
  7. michelangelo

    michelangelo Active Member

    The cron file was correctly generated. The only question that remains is, why the PHP interpreter is the default of the OS.
    Could you post the content of the root of the webspace? This would be /var/www/<domain>/
    Does the PHP binary also exist in /var/www/<domain>/usr/bin/php ?
     
    Last edited: Jul 31, 2025
  8. Sergio W.

    Sergio W. Member

    Sure, thanks.

    Code:
    drwxr-xr-x 17 root   root     4.0K lug 31 12:02 .
    drwxr-xr-x  3 root   root     4.0K apr 18 14:36 ..
    drwxr-xr-x  2 web1   client1  4.0K apr 18 14:36 backup
    lrwxrwxrwx  1 root   root        7 lug 31 12:02 bin -> usr/bin
    drwxr-xr-x  2 web1   client1  4.0K apr 18 14:36 cgi-bin
    drwxr-x---  2 web1   client1  4.0K mag  8 14:44 .composer
    drwxr-xr-x  2 root   root     4.0K lug 31 12:02 dev
    drwxr-xr-x  6 root   root     4.0K lug 31 12:02 etc
    drwxr-xr-x  3 web1   root     4.0K lug 31 12:02 home
    lrwxrwxrwx  1 root   root        7 lug 31 12:02 lib -> usr/lib
    lrwxrwxrwx  1 root   root        9 lug 31 12:02 lib64 -> usr/lib64
    drwxr-xr-x  2 root   root     4.0K lug 31 08:49 log
    drwx--x---  2 web1   client1  4.0K apr 18 14:36 private
    drwxr-xr-x  3 root   root     4.0K lug 31 12:02 run
    drwx------  2 web1   client1  4.0K apr 18 14:36 .ssh
    drwxr-xr-x  2 root   root     4.0K apr 23 13:57 ssl
    drwxrwxrwx  2 web1   client1  1.4M lug 31 20:28 tmp
    drwxr-xr-x  7 root   root     4.0K lug 31 12:02 usr
    drwxr-xr-x  4 root   root     4.0K lug 31 12:02 var
    drwxr-xr-x  5 web1   client1  4.0K lug 31 08:46 web
    
    This is in usr/bin/
    Code:
    lrwxrwxrwx 1 root root   21 lug 31 12:02  php -> /etc/alternatives/php
    -rwxr-xr-x 1 root root 5.6M lug  3 18:11  php8.3
    
     
  9. michelangelo

    michelangelo Active Member

    Okay, where is /etc/alternatives/php pointing to? It should point to /usr/bin/php8.3, if that is the only PHP binary in your jail's /usr/bin directory.
     
  10. Sergio W.

    Sergio W. Member

    Code:
    # ls -l /etc/alternatives/php
    lrwxrwxrwx 1 root root 15 apr 15 11:42 /etc/alternatives/php -> /usr/bin/php8.3
     
  11. michelangelo

    michelangelo Active Member

    From what you've posted I see nothing wrong with how the PHP jail was configured.
    Could you enable cron logging for your cronjob in ISPConfig and check if any errors are logged?
     
  12. Sergio W.

    Sergio W. Member

    The only errors logged are those at post #6
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    @michelangelo meant you should enable logging for your cronjob and then post the log of your cronjob, and not the ispconfig log file you posted in #6.
     

Share This Page