vHost Alias / vHost Subdomain: Recursive chmod and chown can hang the cron on large / network filesystems
short description
Creating a vhost alias triggers a chown and chmod on the complete web root. If the webroot is huge and/or on a slow FS this takes some time and is not required at all.
correct behaviour
It should be considered on vHost Alias / vHost Subdomain to no call chmod and chmod recursive on the /web folder
environment
Server OS: centos
Server OS version: centos7
ISPConfig version: 3.2.2
CLI PHP: 7.2
proposed fix
If vhostalias or vhostsubdomain, call the following lines NOT recursive:
$app->system->exec_safe('chmod -R a+r ?', $data['new']['document_root'].'/' . $web_folder . '/');
$app->system->exec_safe('chown -R ?:? ?', $username, $groupname, $data['new']['document_root'].'/' . $web_folder);
The Cron log
You can see the cron working for 13 minutes on each of the operations.
Mi 10. Feb 16:45:02 CET 2021 10.02.2021-16:45 - DEBUG - Calling function 'ssl' from plugin 'nginx_plugin' raised by event 'web_domain_insert'.
Mi 10. Feb 16:45:02 CET 2021 10.02.2021-16:45 - DEBUG - Calling function 'insert' from plugin 'nginx_plugin' raised by event 'web_domain_insert'.
Mi 10. Feb 16:45:02 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: chattr -i '/var/www/clients/client1/web1' - return code: 0
Mi 10. Feb 16:45:03 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: mkdir -p '/var/log/ispconfig/httpd/domain.de' - return code: 0
Mi 10. Feb 16:45:03 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: mount --bind '/var/log/ispconfig/httpd/domain.de' '/var/www/clients/client1/web1/log/domain.de' - return code: 0
Mi 10. Feb 16:45:03 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: chattr +i '/var/www/clients/client1/web1' - return code: 0
Mi 10. Feb 16:45:03 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: ln -s '/var/www/clients/client1/web1/' '/var/www/domain.de' - return code: 0
Mi 10. Feb 16:45:04 CET 2021 10.02.2021-16:45 - DEBUG - Creating symlink: ln -s /var/www/clients/client1/web1/ /var/www/domain.de
Mi 10. Feb 16:45:04 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: ln -s '/var/www/clients/client1/web1/' '/var/www/clients/client1/domain.de' - return code: 0
Mi 10. Feb 16:45:04 CET 2021 10.02.2021-16:45 - DEBUG - Creating symlink: ln -s /var/www/clients/client1/web1/ /var/www/clients/client1/domain.de
Mi 10. Feb 16:45:04 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: cp '/usr/local/ispconfig/server/conf-custom/error/'*.html '/var/www/clients/client1/web1/web/error/' - return code: 0
Mi 10. Feb 16:45:04 CET 2021 10.02.2021-16:45 - DEBUG - safe_exec cmd: chmod -R a+r '/var/www/clients/client1/web1/web/error/' - return code: 0
Mi 10. Feb 16:46:01 CET 2021 10.02.2021-16:46 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:47:02 CET 2021 10.02.2021-16:47 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:48:01 CET 2021 10.02.2021-16:48 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:49:01 CET 2021 10.02.2021-16:49 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:50:01 CET 2021 10.02.2021-16:50 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:51:01 CET 2021 10.02.2021-16:51 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:52:01 CET 2021 10.02.2021-16:52 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:53:02 CET 2021 10.02.2021-16:53 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:54:01 CET 2021 10.02.2021-16:54 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:55:01 CET 2021 10.02.2021-16:55 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:56:01 CET 2021 10.02.2021-16:56 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:57:01 CET 2021 10.02.2021-16:57 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:58:02 CET 2021 10.02.2021-16:58 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 16:58:40 CET 2021 10.02.2021-16:58 - DEBUG - safe_exec cmd: chmod -R a+r '/var/www/clients/client1/web1/web/' - return code: 0
Mi 10. Feb 16:59:01 CET 2021 10.02.2021-16:59 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:00:01 CET 2021 10.02.2021-17:00 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:01:01 CET 2021 10.02.2021-17:01 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:02:01 CET 2021 10.02.2021-17:02 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:03:01 CET 2021 10.02.2021-17:03 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:04:01 CET 2021 10.02.2021-17:04 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:05:01 CET 2021 10.02.2021-17:05 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:06:02 CET 2021 10.02.2021-17:06 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:07:01 CET 2021 10.02.2021-17:07 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:08:01 CET 2021 10.02.2021-17:08 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:09:01 CET 2021 10.02.2021-17:09 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:10:02 CET 2021 10.02.2021-17:10 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:11:01 CET 2021 10.02.2021-17:11 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:12:02 CET 2021 10.02.2021-17:12 - WARNING - There is already an instance of server.php running with pid 1920.
Mi 10. Feb 17:12:16 CET 2021 10.02.2021-17:12 - DEBUG - safe_exec cmd: chown -R 'web1':'client1' '/var/www/clients/client1/web1/web' - return code: 0
Mi 10. Feb 17:12:17 CET 2021 10.02.2021-17:12 - DEBUG - safe_exec cmd: chown 'web1':'client1' '/var/www/clients/client1/web1/web' - return code: 0
Mi 10. Feb 17:12:17 CET 2021 10.02.2021-17:12 - DEBUG - safe_exec cmd: chattr +i '/var/www/clients/client1/web1' - return code: 0
Edited by JanThiel