Author Topic: Creating new runit service  (Read 2390 times)


  • Newbie
  • *
  • Posts: 5
  • Karma: +1/-0
Creating new runit service
« on: Tue May 23 11:16:11 2023 »
Some background first:

After discovering that NuTyX offer the runit init system I wanted to share a small tutorial how to create an new runit service.

Setting Up NuTyX:

To be able to use runit as init system on NuTyX, we need to change the default init system. Note that on NuTyX runit programm is named runyx.

Onces you did all the changes as explain in the tuto above, you are now ready to reboot and create a new runit service.

Files and Folders locations:

- The /lib/init/services/ folder contains all the services directory that comes with every specific packages.
- The /etc/init folder contains the different run mode directories (single or multi) and a link to the current running mode.

The dockerd example:

Code: [Select]
cd /lib/init/services/
sudo mkdir dockerd
cd dockerd

We now create a file called run
with following contents:
Code: [Select]
[ -e /run/dbus/system_bus_socket ] || exit 1
exec /usr/bin/dockerd

Make sure the run file is executable:

Code: [Select]
sudo chmod 755 run
Start the dockerd example service:

In runit (or runyx) world to start a service we simply create a new link to the desire run mode (single or multi). In our example let's start dockerd when we are in multimode.

Code: [Select]
sudo ln -sv /lib/init/services/dockerd /etc/init/multi/dockerd
Dockerd service is now up and running

Stop the dockerd example service:

To stop the service you simply remove the link just created.
Code: [Select]
sudo rm /etc/init/multi/dockerdNote that you simply remove the link and not the script it self

I am Dengesiz Kokarca!

Review and correct by Thierry ;)
« Last Edit: Tue May 30 09:04:18 2023 by Thierry »