Using the custom package item feature to alter user httpd.conf files

If you're trying to add custom features/options into DA pacakges, and want those to affect certain areas on the system (in this example, user httpd.conf file), you can do so using a combination of several features in DA.

- custom package items - direct editing of /usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd - using domain pre/post script

1) The first step is to use the custom package item feature to add the checkbox/fields you want into the pacakges.

2) Then create the domain_create_post.sh script to grab that info from

/usr/local/directadmin/data/users/$username/user.conf

to make decisions as to what to alter, how to alter it, etc. (based on your requirements)

3) In this example, we want to change the httpd.conf, so have the post script edit/create:

/usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd

and insert whatever code you need in it. Be sure to run the command:

echo "action=rewrite&value=httpd&user=$username" >> /usr/local/directadmin/data/task.queue

so that the change you make to the $domain.cust_httpd file is applied.

4) Since this is a package option, any change you make to the package/user will alter the user, not the domain, so you'd need to also create

/usr/local/directadmin/scripts/custom/user_modify_post.sh

and have it repeat the same basic idea as for domain_create_post.sh, but in the case you're disabling the feature, to remove the code from the cust_httpd file, for all domains that belong to the user.

 
config/custom_package.txt · Last modified: 2010/04/29 09:14 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki