Changes

From SME Server
Jump to navigationJump to search
Line 452: Line 452:  
Another file will take precedence without hiding it: /etc/systemd/system-preset/49-koozali.preset. This file is templated, and uses the e-smith configuration db to list services that should be enabled or disabled based on admin changes.
 
Another file will take precedence without hiding it: /etc/systemd/system-preset/49-koozali.preset. This file is templated, and uses the e-smith configuration db to list services that should be enabled or disabled based on admin changes.
   −
It is important that this file is called 49-koozali.preset and not 50-Koozali.preset, so it does not hide 50-Koozali.preset content, but take precedence on it. Hence, anything not declared in 49-koozali.preset will take the state of what declare the 50 one. <!-- k or K? -->
+
It is important that this file is called 49-koozali.preset (k or K?) and not 50-Koozali.preset, so it does not hide 50-Koozali.preset content, but take precedence on it. Hence, anything not declared in 49-koozali.preset will take the state of what declare the 50 one. <!-- k or K? -->
   −
Then we use an action script to default all we want in systemd: /etc/e-smith/events/actions/systemd-default<syntaxhighlight lang="bash">
+
Then we use an action script to default all we want to be in systemd: /etc/e-smith/events/actions/systemd-default<syntaxhighlight lang="bash">
 
#!/usr/bin/bash
 
#!/usr/bin/bash
 
/usr/bin/systemctl  enable sme-server.target
 
/usr/bin/systemctl  enable sme-server.target
Line 461: Line 461:  
/usr/bin/systemctl  set-default sme-server.target
 
/usr/bin/systemctl  set-default sme-server.target
   −
</syntaxhighlight>This will ensure that on every run, all service explicitly enabled or disabled in the configuration db are declared this way in systemd, and if they are not in the db they be according to what is declared in other /lib/systemd/system-preset/* files.
+
</syntaxhighlight>This will ensure that on every run, all services explicitly enabled or disabled in the configuration db are declared this way in systemd, and if they are not in the db they are controlled according to what is declared in other /lib/systemd/system-preset/* files.
    
Any services not explicitly declared there will be disabled (/lib/systemd/system-preset/99-default-disable.preset). So If you want a service to run you need to declare it at the very least with :<syntaxhighlight lang="bash">
 
Any services not explicitly declared there will be disabled (/lib/systemd/system-preset/99-default-disable.preset). So If you want a service to run you need to declare it at the very least with :<syntaxhighlight lang="bash">
Line 470: Line 470:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Note you can also declare a service unit name with a service name with a different name. This is beta for the moment, it might conflict with some other script handling the services (/sbin/e-smith/service, bootstrap-console;  controlService perl function from /usr/share/perl5/vendor_perl/esmith/util.pm) <syntaxhighlight lang="bash">
+
Note you can also declare a service unit name with a service name with a different name. This is in beta for the moment, as it might conflict with some other script handling the services (/sbin/e-smith/service, bootstrap-console;  controlService perl function from /usr/share/perl5/vendor_perl/esmith/util.pm) <syntaxhighlight lang="bash">
 
db configuration set myservice service status enabled SystemdUnit service@my.service
 
db configuration set myservice service status enabled SystemdUnit service@my.service
 
expand-template /etc/systemd/system/preset/49-koozali.preset
 
expand-template /etc/systemd/system/preset/49-koozali.preset
Line 477: Line 477:     
==== service-status ====
 
==== service-status ====
We use as ExecStartPre a call to a script preventing any unwanted launch of a disabled service. This is pretty radical and jsut fails the service with a message at any trial to start it. This is in case one starts it manually or has it enabled and prevent an event to run to disable it before reboot.
+
We run as ExecStartPre a call to a script preventing any unwanted launch of a disabled service. This is basic and just fails the service with a message at any attempt to start it. This deals with the case that it has been started manually, or has been enabled, and prevents an event from running to disable it before reboot (is this correct?)
   −
Currently the script just fails, but we could imagine in a future to have a property in the db to make it just send a warning and let the service start.<syntaxhighlight lang="bash">
+
Currently the script just fails, but we could in the future have a property in the db to make it just send a warning and let the service start.<syntaxhighlight lang="bash">
 
#! /bin/sh
 
#! /bin/sh
   Line 515: Line 515:  
Runit and Sysvinit were allowing some signals that are not handled anymore by systemd. We will have to replace those.
 
Runit and Sysvinit were allowing some signals that are not handled anymore by systemd. We will have to replace those.
   −
'''As an example <u>service masq adjust</u> need to be replaced by <u>systemctl reload masq.service</u>.'''
+
'''As an example <u>service masq adjust</u> needs to be replaced by <u>systemctl reload masq.service</u>.'''
    
for the following we could use  <code>kill --signal=</code>  
 
for the following we could use  <code>kill --signal=</code>  
Line 538: Line 538:     
===== Previous pure Syvinit service, with a provided systemd unit =====
 
===== Previous pure Syvinit service, with a provided systemd unit =====
Either we are lucky and can simply use the one provided as a replacement, either we add a service.d/50koozali.conf for the service and alter in a way we need.
+
If we are lucky we can simply use the ones provided as a replacement, we add a service.d/50koozali.conf for the service and alter it in the way we need.
    
===== Previous pure Syvinit service, without a provided systemd unit =====
 
===== Previous pure Syvinit service, without a provided systemd unit =====
Line 582: Line 582:     
===== Previous Runit service, with a provided systemd unit =====
 
===== Previous Runit service, with a provided systemd unit =====
Either we are lucky and can simply use the one provided as a replacement, either we add a service.d/50koozali.conf for the service and alter in a way we need.
+
If we are lucky we can simply use the ones provided as a replacement, we add a service.d/50koozali.conf for the service and alter it in the way we need.
   −
AS a last resort we could hide the whole file using the service.d/50koozali.conf  and simply call runit, see next one.
+
As a last resort we could hide the whole file using the service.d/50koozali.conf  and simply call runit, see the next example.
   −
===== Previous Runit service, without a provided systemd uni =====
+
===== Previous Runit service, without a provided systemd unit =====
 
example of wan : /lib/systemd/system/wan.service<syntaxhighlight lang="bash">
 
example of wan : /lib/systemd/system/wan.service<syntaxhighlight lang="bash">
 
[Unit]
 
[Unit]

Navigation menu