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 60: |
Line 67: |
| | | |
| If the template you have copied includes perl code, you will need to write the appropriate perl code to create your new output, or place your text changes after the final closing brace ("}") of the perl commands. | | If the template you have copied includes perl code, you will need to write the appropriate perl code to create your new output, or place your text changes after the final closing brace ("}") of the perl commands. |
| + | |
| + | ===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 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==== |
| + | The qpsmtpd 'plugins' directives in /etc/e-smith/templates/var/service/qpsmtpd/config/plugins do NOT affect the content of /var/service/qpsmtpd/plugins as expected. |
| + | |
| + | Instead, due to this line in /etc/e-smith/'''templates.metadata'''/var/service/qpsmtpd/config/plugins: |
| + | OUTPUT_FILENAME="/var/service/qpsmtpd/config/peers/0" |
| + | |
| + | This command: |
| + | expand-template /var/service/qpsmtpd/config/plugins |
| + | |
| + | Will actually update the contents of /var/service/qpsmtpd/config/peers/0. |
| + | |
| + | Note: /var/service/qpsmtpd/config/plugins is not templated at this time. |
| + | |
| + | ====/etc/samba/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 76: |
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 96: |
Line 129: |
| Expand template and restart masq (masquerading) | | Expand template and restart masq (masquerading) |
| expand-template /etc/rc.d/init.d/masq | | expand-template /etc/rc.d/init.d/masq |
| + | |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl restart masq |
| + | </tab><tab name="For SME 9 and before"> |
| /etc/init.d/masq restart | | /etc/init.d/masq restart |
− | | + | </tab> |
| + | </tabs> |
| Check your change is working | | Check your change is working |
| | | |
Line 120: |
Line 158: |
| cp /etc/e-smith/templates/etc/my.cnf/005mysqld /etc/e-smith/templates-custom/etc/my.cnf/005mysqld | | cp /etc/e-smith/templates/etc/my.cnf/005mysqld /etc/e-smith/templates-custom/etc/my.cnf/005mysqld |
| Edit and make your required additions & changes. This is where you add the changes determined from the mysql documentation. | | Edit and make your required additions & changes. This is where you add the changes determined from the mysql documentation. |
− | pico -w /etc/e-smith/templates-custom/etc/my.cnf/005mysqld | + | nano -w /etc/e-smith/templates-custom/etc/my.cnf/005mysqld |
| Save and exit | | Save and exit |
| Ctrl o | | Ctrl o |
Line 126: |
Line 164: |
| Expand template and restart mysqld | | Expand template and restart mysqld |
| expand-template /etc/my.cnf | | expand-template /etc/my.cnf |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl restart mariadb |
| + | </tab><tab name="For SME 9 and before"> |
| sv t /service/mysqld | | sv t /service/mysqld |
| + | </tab> |
| + | </tabs> |
| Check status of the service | | Check status of the service |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl status mariadb |
| + | </tab><tab name="For SME 9 and before"> |
| sv s /service/mysqld | | sv s /service/mysqld |
| + | </tab> |
| + | </tabs> |
| | | |
| In this particular example there appears to be a requirement to share the mysql databases with LAN (local) or WAN (external) users. To achieve this you may need to change access permissions to your mysql databases, refer | | In this particular example there appears to be a requirement to share the mysql databases with LAN (local) or WAN (external) users. To achieve this you may need to change access permissions to your mysql databases, refer |
Line 142: |
Line 190: |
| rm /etc/e-smith/templates-custom/etc/my.cnf/005mysqld | | rm /etc/e-smith/templates-custom/etc/my.cnf/005mysqld |
| expand-template /etc/my.cnf | | expand-template /etc/my.cnf |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl restart mariadb |
| + | </tab><tab name="For SME 9 and before"> |
| sv t /service/mysqld | | sv t /service/mysqld |
| + | </tab> |
| + | </tabs> |
| + | |
| Check status of the service | | Check status of the service |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl status mariadb |
| + | </tab><tab name="For SME 9 and before"> |
| sv s /service/mysqld | | sv s /service/mysqld |
| + | </tab> |
| + | </tabs> |
| | | |
| ====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.}} |
| 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: |
− | pico -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"> |
| + | systemctl restart php-fpm |
| + | </tab><tab name="For SME 9 and before"> |
| sv t /service/httpd-e-smith | | sv t /service/httpd-e-smith |
− | | + | </tab> |
| + | </tabs> |
| Examine /etc/php.ini to see that your changes have been created. | | Examine /etc/php.ini to see that your changes have been created. |
− |
| |
| | | |
| ====httpd.conf==== | | ====httpd.conf==== |
Line 173: |
Line 235: |
| mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf | | mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf |
| | | |
− | Edit the template fragment with vi or pico | + | Edit the template fragment with vi or nano |
| cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf | | cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf |
− | pico 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 |
| | | |
− | Save & exit from vi or pico | + | Save & exit from vi or nano |
| Ctrl c | | Ctrl c |
| Ctrl x | | Ctrl x |
Line 186: |
Line 248: |
| Expand template & restart service | | Expand template & restart service |
| expand-template /etc/httpd/conf/httpd.conf | | expand-template /etc/httpd/conf/httpd.conf |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | systemctl status httpd-e-smith |
| + | </tab><tab name="For SME 9 and before"> |
| sv t /service/httpd-e-smith | | sv t /service/httpd-e-smith |
| + | </tab> |
| + | </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 196: |
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 205: |
Line 272: |
| | | |
| A full list of error codes can be found at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html | | A full list of error codes can be found at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
| + | |
| + | ====smb.conf==== |
| + | |
| + | This example comes from a forum post at http://forums.contribs.org/index.php/topic,49238.0.html where a user asks how to enable domain login to SME8 server from Windows 98 workstations, |
| + | |
| + | and is based on advice from http://ubuntuforums.org/showthread.php?t=1617097 |
| + | |
| + | The SME server template fragments were examined & it was determined that the most suitable for the requirement was /etc/e-smith/templates/etc/smb.conf/11lanmanPasswords |
| + | |
| + | Make a custom template folder |
| + | 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 |
| + | cd /etc/e-smith/custom-templates/etc/smb.conf |
| + | nano 11lanmanPasswords |
| + | |
| + | and change the contents to the following code (in this example the perl code shown will allow parameters to be controlled by db commands rather than hard coding the parameters as text into the fragment) |
| + | { |
| + | $OUT .= "lanman auth = $smb{'LanManPasswords'}\n" if $smb{'LanManPasswords'}; |
| + | $OUT .= "client lanman auth = $smb{'ClientLanManPasswords'}\n" if $smb{'ClientLanManPasswords'}; |
| + | $OUT .= "client plaintext auth = $smb{'ClientPlaintextPasswords'}\n" if $smb{'ClientPlaintextPasswords'}; |
| + | } |
| + | |
| + | Save & exit from nano |
| + | Ctrl c |
| + | Ctrl x |
| + | |
| + | Then check & note current settings |
| + | config show smb |
| + | |
| + | Then issue |
| + | config setprop smb LanManPasswords yes |
| + | config setprop smb ClientLanManPasswords yes |
| + | config setprop smb ClientPlaintextPasswords yes |
| + | |
| + | Expand template & restart service (both included in the one signal-event command) |
| + | signal-event workgroup-update |
| + | |
| + | Then review settings |
| + | config show smb |
| + | |
| + | Then manually check /etc/samba/smb.conf to see all changes & settings are present eg |
| + | cat /etc/samba/smb.conf |
| + | |
| + | Additional steps are required to modify passwords for Windows 98 users, from this post http://ubuntuforums.org/showthread.php?t=1617097 |
| + | |
| + | Re input passwords for every Windows 98 user (where username is the sme user who is logging into any Windows 98 workstation) |
| + | smbpasswd -a username |
| + | Then every Windows 98 user should log out and then log in again on their Windows 98 workstations (to pick up the changes on the server & allow successful login) |
| + | |
| | | |
| | | |
Line 248: |
Line 365: |
| Here is a process that can be followed when trying to reverse-engineer a situation with a template or db setting affecting a website: | | Here is a process that can be followed when trying to reverse-engineer a situation with a template or db setting affecting a website: |
| | | |
| + | |
| + | <tabs container style="display: inline-block;"><tab name="For SME 10"> |
| + | in SME10 the command to restart the web server will expand also the template and overwrite your temp changes |
| + | so just edit the db setting you want and do that |
| + | systemctl status httpd-e-smith |
| + | </tab><tab name="For SME 9 and before"> |
| | | |
| Edit /etc/httpd/conf/httpd.conf directly. | | Edit /etc/httpd/conf/httpd.conf directly. |
Line 254: |
Line 377: |
| | | |
| insert the required commands | | insert the required commands |
− |
| |
| restart the web server using | | restart the web server using |
− | sv t httpd-e-smith | + | sv t /service/httpd-e-smith |
| + | </tab> |
| + | </tabs> |
| | | |
| test | | test |
Line 322: |
Line 446: |
| ---- | | ---- |
| [[Category:Howto]] | | [[Category:Howto]] |
| + | [[Category:Developer]] |