Control Web Panel

WebPanel => Apache => Topic started by: Kockel on September 18, 2024, 07:47:59 AM

Title: Create extra folder in home directory when creating users
Post by: Kockel on September 18, 2024, 07:47:59 AM
Hello,

I created a specific virtual host template for websites.
I want to host the log files under the home directory

This is what I added :

   # CustomLog /home/kockel/logs/kockel.be.bytes bytes
   CustomLog /home/kockel/logs/kockel.be.log combined
   ErrorLog /home/kockel/logs/kockel.be.error.log

Everything is created fine when creating a new user.
Only big issue : the logs folder is NOT created...
When rebooting apache, it fails...

Anyone has a solution for this? Are there any template folders that I need to adjust? or a script?
Title: Re: Create extra folder in home directory when creating users
Post by: cyberspace on September 18, 2024, 08:26:52 PM
Use CWP Account Hooks:
https://wiki.centos-webpanel.com/action-hooks
to create folders inside the account.
Title: Re: Create extra folder in home directory when creating users
Post by: Kockel on September 25, 2024, 01:49:01 PM
<?php
function account_new($array){
        mkdir("/home/$array[username]/logs", 0755);
}
?>

Solved with cwp hooks