0
задан 24 July 2020 в 10:51

1 ответ

There are two common ways to start a service on Ubuntu:

  1. Making a service file in /etc/init.d directory.

You can check the existing ones as examples. There used to be a template file named skeleton which is no more exists. However you can find a basic example and more help by running man init-d-script.

After creating the file run sudo update-rc.d myservice defaults to install your service (here referred as myservice). refer to update-rec.d, Then you can start and stop your service using sudo service myservice start

  1. The second and recommended or new one is creating a SystemD service.

To know the difference with the above check: Difference between systemctl init.d and service

Here is a simple example of how to create and run your service:

https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/

You can also refer to his manual page for detailed descriptions of these two styles:

http://0pointer.de/public/systemd-man/daemon.html

0
ответ дан 30 July 2020 в 22:04

Другие вопросы по тегам:

Похожие вопросы: