Keeping your .NET Apps Alive with Supervisor

Supervisor as a Background Service Manager

Supervisor is a service which can be used on a Raspberry Pi to ensure processes keep running. If there’s an app that requires execution 24 / 7 then SuperVisor is perfect for this. Perfect for kiosk solutions.

1. Install Supervisor

Log into the Raspberry Pi

At the command prompt type: sudo apt install supervisor -y

2. Start Supervisor the Supervisor Service

At the command prompt type:   sudo service supervisor start

3. Create a Supervisor Process

Use an editor such as nano to create a project file project.supervisor.conf in the /etc/supervisor/conf.d/ folder

Add this to the contents of the file

Create file project.supervisor.conf in etc/supervisor/conf.d/
and put:

[program:microlights]
user=pi
directory=/home/pi/MicroLights
command=sudo dotnet /home/pi/MicroLights/MicroLights.dll

autostart=true
autorestart=true
stdout_logfile=/home/pi/MicroLights/stdout.log
stderr_logfile=/home/pi/MicroLights/stderr.log


4. Request Supervisor to re-read configuration and Update

sudo supervisorctl reread
sudo supervisorctl update

5. Staus of Commands

sudo supervisorctl status microlights
sudo supervisorctl start microlights
sudo supervisorctl stop microlights
sudo supervisorctl restart microlights