Line 26: |
Line 26: |
| expand-template /etc/file.conf | | expand-template /etc/file.conf |
| | | |
− | You also need to restart affected services using
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl restart dhcpd |
| + | </tab><tab name="For SME 9 and before"> |
| + | for supervised services |
| sv t /service/servicename | | sv t /service/servicename |
| + | or for any service |
| + | service restart servicename |
| + | </tab> |
| + | </tabs> |
| | | |
| Some signal events combine template expansion and service restart | | Some signal events combine template expansion and service restart |
Line 64: |
Line 71: |
| Template output file location, ownership, and other metadata can also be controlled by configuration settings stored under /etc/e-smith/templates.metadata. | | Template output file location, ownership, and other metadata can also be controlled by configuration settings stored under /etc/e-smith/templates.metadata. |
| | | |
− | While the default output location for most templated config files matches the path to the collection of template fragements, it is also possible to specify a different output filename using an entry within the /etc/e-smith/templates.metadata folder. | + | While the default output location for most templated config files matches the path to the collection of template fragments, it is also possible to specify a different output filename using an entry within the /etc/e-smith/templates.metadata folder. |
| | | |
| ====/var/service/qpsmtpd/config/peers/0==== | | ====/var/service/qpsmtpd/config/peers/0==== |
Line 80: |
Line 87: |
| | | |
| ====/etc/samba/smb.cnf==== | | ====/etc/samba/smb.cnf==== |
− | /etc/samba/smb.cnf is updated based on the template fragments in /etc/e-smith/templates/etc/smb.cnf | + | /etc/samba/smb.cnf is updated based on the template fragments in /etc/e-smith/templates/etc/smb.cnf. |
| | | |
| ===Specific practical examples=== | | ===Specific practical examples=== |
Line 97: |
Line 104: |
| Expand template and restart dhcpd | | Expand template and restart dhcpd |
| expand-template /etc/dhcpd.conf | | expand-template /etc/dhcpd.conf |
| + | |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl restart dhcpd |
| + | </tab><tab name="For SME 9 and before"> |
| sv t /service/dhcpd | | sv t /service/dhcpd |
− | | + | </tab> |
| + | </tabs> |
| Examine /etc/dhcpd.conf to see that your changes have been created. | | Examine /etc/dhcpd.conf to see that your changes have been created. |
| | | |
Line 194: |
Line 206: |
| | | |
| ====php.ini==== | | ====php.ini==== |
− | {{Note box|This is only valid for SME 9 and before. Starting SME10, php-fpm pools are in use. And default php pool is php74-IBAYNAME. php74 will use its own php.ini in /etc/opt/remi/php74/php.ini but thoses values are overriden by the php-fpm.d/ibays.conf which is also templates. and the service to restart would be php74-php-fpm. If you set to use another version of php, then you need to change 74 to the other version eg 80 with the exception of Core version for 54 in SME10 is defined by service php-fpm.}} | + | {{Note box|This is only valid for SME 9 and before. Starting SME10, php-fpm pools are in use. And default php pool is php74-IBAYNAME. php74 will use its own php.ini in /etc/opt/remi/php74/php.ini but thoses values are overriden by the php-fpm.d/ibays.conf which is also templates. And the service to restart would be php74-php-fpm. If you set to use another version of php, then you need to change 74 to the other version eg 80 with the exception of Core version for 54 in SME10 is defined by service php-fpm.}} |
| Examine the template fragments in /etc/e-smith/templates/etc/php.ini and determine which fragment you wish to change. | | Examine the template fragments in /etc/e-smith/templates/etc/php.ini and determine which fragment you wish to change. |
− | Let's say you want to modify a value that is in the 40DataHandling fragment | + | Let's say you want to modify a value that is in the 40DataHandling fragment. |
| | | |
− | Copy the fragment to the custom template tree | + | Copy the fragment to the custom template tree: |
| mkdir -p /etc/e-smith/templates-custom/etc/php.ini | | mkdir -p /etc/e-smith/templates-custom/etc/php.ini |
| cp /etc/e-smith/templates/etc/php.ini/40DataHandling /etc/e-smith/templates-custom/etc/php.ini/40DataHandling | | cp /etc/e-smith/templates/etc/php.ini/40DataHandling /etc/e-smith/templates-custom/etc/php.ini/40DataHandling |
− | Edit the fragment and make your required changes | + | Edit the fragment and make your required changes: |
| nano -w /etc/e-smith/templates-custom/etc/php.ini/40DataHandling | | nano -w /etc/e-smith/templates-custom/etc/php.ini/40DataHandling |
− | Save changes and exit (press the following keys together) | + | Save changes and exit (press the following keys together): |
| Ctrl o | | Ctrl o |
| Ctrl x | | Ctrl x |
− | Expand template and restart httpd-e-smith | + | Expand template and restart httpd-e-smith: |
− | expand template /etc/php.ini | + | expand-template /etc/php.ini |
| <tabs container style="display: inline-block;"><tab name="For SME 10"> | | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| systemctl restart php-fpm | | systemctl restart php-fpm |
Line 226: |
Line 238: |
| cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf | | cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf |
| nano S85ErrorPages | | nano S85ErrorPages |
− | and add the following text | + | and add the following text: |
| # Add custom error pages here | | # Add custom error pages here |
| ErrorDocument 404 /notfound.html | | ErrorDocument 404 /notfound.html |
Line 243: |
Line 255: |
| </tabs> | | </tabs> |
| | | |
− | Using your favourite html editor, create a suitable web page & save it in the Primary/html ibay (or otherwise applicable ibay) with the filename of notfound.html | + | Using your favourite html editor, create a suitable web page & save it in the Primary/html ibay (or otherwise applicable ibay) with the filename of notfound.html. |
| | | |
| Then open your browser and type in an incorrect URL (making sure the domain is valid) eg | | Then open your browser and type in an incorrect URL (making sure the domain is valid) eg |
Line 251: |
Line 263: |
| If custom error pages are required for virtual domains, create a new html error page for each domain and save it in the html folder of the appropriate ibay. | | If custom error pages are required for virtual domains, create a new html error page for each domain and save it in the html folder of the appropriate ibay. |
| | | |
− | This concept can also apply to other common error document pages such as | + | This concept can also apply to other common error document pages such as: |
| | | |
| 400 Bad Request | | 400 Bad Request |
Line 270: |
Line 282: |
| | | |
| Make a custom template folder | | Make a custom template folder |
− | cp /etc/e-smith/templates/etc/smb.conf/11lanmanPasswords /etc/e-smith/custom-templates/etc/smb.conf/ | + | cp /etc/e-smith/templates/etc/smb.conf/11lanmanPasswords /etc/e-smith/templates-custom/etc/smb.conf/ |
| | | |
| Edit the template fragment with vi, nano or nano | | Edit the template fragment with vi, nano or nano |
Line 395: |
Line 407: |
| Now edit the "custom" template fragment created, and those contents will be used instead of the default template fragment used when the affected file (/etc/httpd/conf/httpd.conf) is generated using 'expand-template'. | | Now edit the "custom" template fragment created, and those contents will be used instead of the default template fragment used when the affected file (/etc/httpd/conf/httpd.conf) is generated using 'expand-template'. |
| | | |
− | Some templates are inserted as literal text into the output files, and some templates are actually running perl code to generate the output text. The perl templates will include braces ("{" and "}") and will likely contain lines beginning with [blue]$OUT .= "blah, blah, blah";[/blue]. If the template you've decided to copy includes perl code, you will need to write perl code to create your new output or place your changes after the final closing brace ("}") of the perl commands. | + | Some templates are inserted as literal text into the output files, and some templates are actually running perl code to generate the output text. The perl templates will include braces ("{" and "}") and will likely contain lines beginning with <span style="color:#0000FF">$OUT .= "blah, blah, blah";</span>. If the template you've decided to copy includes perl code, you will need to write perl code to create your new output or place your changes after the final closing brace ("}") of the perl commands. |
| | | |
| After making the changes: | | After making the changes: |