Systemd - nmsd

Is done here: https://github.com/schmto/nmsprime/blob/dev/modules/ProvBase/Install/files/nmsprimed.service

and here: https://github.com/schmto/nmsprime/blob/dev/modules/ProvBase/Install/after_install.sh

 

  • every service that needs to be restarted shall create a file in app/storage/systemd/ named like the service that indicates a needed restart for the provisioning-related-services-controlling daemon
  • this daemon calls the restart script that has to be placed under app/extensions/systemd/ named like the service with file ending .php where the daemon is placed as well
  • following unit script has to be placed with path /usr/lib/systemd/system/

nmsd.service
[Unit]
Description=Controlling-Deamon for Provisioning-related-Services
Documentation=
Wants=network-online.target
After=network-online.target
After=time-sync.target

[Service]
Type=simple
ExecStart=/usr/bin/php -f /var/www/nmsprime/app/extensions/systemd/nmsd.php

[Install]
WantedBy=multi-user.target

 

To enable and start nmsd issue the following commands:

systemctl daemon-reload
systemctl enable nmsprimed.service
systemctl start nmsprimed.service

 

  • every service that needs to be restarted when it's config was changed through laravel provisioning system has to be inserted into the services array on top of the file
  • the deamon proofs now if there is an indicating file under app/storage/systemd/, deletes this file and restarts the service while suspending race conditions (proof if restart script already runs)