If you're not a super user or root, and if your Linux system has Docker installed, then you can create a docker image of your process, using docker to restart your process if the system is rebooted.
File: docker-compose.yml
version: "3"
services:
lserver:
image: your_docker_image:latest
ports:
- 8080:8080 # just use 8080 as an example
restart: always # this is where your process can be guaranteed to restart
To start your docker container,
docker-compose up -d
I find it's easy to handle my-own-process with auto-restart if I am not a super user of the system.
For a sample example of how to create a docker image, here is a quick example:
File: Dockerfile
FROM alpine:3.5
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
WORKDIR /app
COPY my-process-server /app
RUN ln -s /app/my-process-server /usr/local/bin/my-process-server
EXPOSE 8080
CMD ["my-process-server"]
Sure, but it varies based on distribution. Pretty much all of them provide some kind of service manager. – David Schwartz – 2012-11-19T09:39:02.903
There is no standard distribution, but buildroot. So I have to do it manually... – Honza – 2012-11-19T12:24:28.637