Using PLCnext Yocto Sysvinit to start a dotnet service

Hello, What is the best practice to start a C# DotNet service using SysvInit ? I would prefer using use a modern system like “systemd”, but as your Yocto configuration comes with SysvInit, and that there is not much documentation on how using this service framework to start dotnet application, I wonder if you know how to do it. I am fully open to suggestions. (Note that I already know how to start a dotnet console app on PLCnext and know the basic of SysvInit). Thanks, Frédéric Using 2020.0.1 framework

Hello Frederic, I dont think that this is anything different for .NetCore binaries then for other System Init Processes.

So the best practice for init.d is to provide a update-rc compatible init script and using the start-stop-daemon to setup your binary.

Search for Sysv init.d tutorials and update-rc.

/etc/init.d/skeleton #! /bin/sh


| ### BEGIN INIT INFO
| # Provides: skeleton
| # Required-Start: $remote_fs $syslog
| # Required-Stop: $remote_fs $syslog
| # Default-Start: 2 3 4 5
| # Default-Stop: 0 1 6
| # Short-Description: Example initscript
| # Description: This file should be used to construct scripts to be
| # placed in /etc/init.d.
| ### END INIT INFO
|
| # Author: Foo Bar <foobar@baz.org>;
| #
| # Please remove the “Author” lines above and replace them
| .# with your own name if you copy and modify this script.


Depending on your application you might also think about providing it as a Daemon App.
For easier deployment to your PLCs via the WBM…

https://github.com/PLCnext/PLCnextAppExamples/tree/public/DemoApps

Thanks Oliver. I will look at theses examples soon.

I finally made it work using traditional SysVinit scripting (i.e. without using the command “start-stop-daemon” like the nginx script does)