I created several simple "microservices" for my Raspberry Pi (running Raspbian) for a variety of different purposes, for example:
- HTTP server that reads temperature from a sensor and returns it when it receives a GET request
- A RESTful service for accessing a database
- Service that pings a remote server once per hour
- ...
All of these are self-contained binary executables and I simply have them all in a folder and run them manually via SSH.
I was wondering if there's an existing solution, a "service runner" (or task manager) of sorts that could simplify this process. I'm thinking of something that can do the following:
- Run the executables and save their STDERR to a log file.
- Restart the executables and log / alert when they crash.
- Support some way of updating the executables (and restarting them when this happens).
I'm aware these may be simple to the point where a BASH script might suffice, but I was wondering if there's an existing solution that just covers my use case? Is there an easier approach all together to just run multiple HTTP servers (or just tasks) on a Raspberry Pi?
(I'm specifically looking for lightweight solutions that would work with low-to-zero overhead on a Pi's hardware, which is why I'm asking here rather than some more general Linux SE)
systemctl restart myservice
.