Changes

Jump to navigation Jump to search
2,724 bytes added ,  20:34, 4 July 2022
Line 205: Line 205:  
  service nut start
 
  service nut start
 
Details: [[bugzilla:2738]]
 
Details: [[bugzilla:2738]]
 +
 +
===Manualy install a service on SME 10 and newer===
 +
Starting SME 10 systemd is in used, but there are some backward compatibility for sysvinit and daemontools managed service.
 +
Prefered way to install a non core service is by using a contrib, but if you need to run a service without any contrib available, then here are the steps.
 +
First check if the rpm providing the service includes either a /etc/rc.d/init.d/'''servicename''' or a /usr/lib/systemd/system/'''servicename'''.service files. Replace '''servicename''' by the appropriate name.
 +
 +
====Global steps====
 +
Create a db entry in configuration db:
 +
  config set '''servicename''' service status enabled
 +
 +
====only systemd .service file available====
 +
Create a dropin file to have this service available under sme-server.target as this is our target, we do not use the regular multi-user.target.
 +
mkdir -p  /etc/lib/systemd/system/'''servicename'''.service.d/
 +
printf "[Install]\nWantedBy=sme-server.target\n" > /etc/lib/systemd/system/'''servicename'''.service.d/50koozali.conf
 +
systemctl daemon-reload
 +
/etc/e-smith/events/actions/systemd-default
 +
 +
NB: in a contrib, we would use the /usr/lib/systemd/system/'''servicename'''.service.d/50koozali.conf path as it would be provided by an rpm and not by end-user admin.
 +
 +
====both systemd .service and /etc/rc.d/init.d/'''servicename''' files available====
 +
You need to hide the file in init.d from SME Server internals to be able to enable the service form systemd on reboot
 +
 +
mkdir -p /etc/e-smith/templates-custom/etc/systemd/system-preset/49-koozali.preset/
 +
printf "{
 +
\$customservice=''''servicename'''';
 +
\$OUT="";
 +
\$OUT .= \"enable                \$customservice.service\n\" if \${\$customservice}{'status'} eq \"enabled\";
 +
}" >> /etc/e-smith/templates-custom/etc/systemd/system-preset/49-koozali.preset/99'''servicename'''
 +
expand-template /etc/systemd/system-preset/49-koozali.preset
 +
/etc/e-smith/events/actions/systemd-default
 +
 +
====only /etc/rc.d/init.d/'''servicename''' file available====
 +
 +
cd /etc/rc.d/rc7.d
 +
ln -s ../init.d/'''e-smith-service''' S85'''servicename'''
 +
 +
====only run script in a daemontool runit /service/'''servicename''' folder====
 +
as previously replace servicename to the actual service name
 +
 +
<syntaxhighlight lang="bash" >printf "[Unit]
 +
Description=servicename
 +
Requires=runit.service
 +
 +
[Service]
 +
Type=oneshot
 +
ExecStartPre=/sbin/e-smith/service-status servicename
 +
ExecStart=/usr/bin/sv u /service/servicename
 +
ExecStop=/usr/bin/sv stop /service/servicename
 +
ExecReload=/usr/bin/sv t /service/servicename
 +
RemainAfterExit=yes
 +
 +
[Install]
 +
WantedBy=sme-server.target" > /etc/systemd/system/servicename.service
 +
systemctl daemon-reload
 +
/etc/e-smith//events/actions/systemd-default
 +
</syntaxhighlight>
    
==Packages==
 
==Packages==
Super Admin, Wiki & Docs Team, Bureaucrats, Interface administrators, Administrators
3,250

edits

Navigation menu