Help > Beginners

Creating new runit service

(1/1)

unbalancedskunk:
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: ---cd /lib/init/services/
sudo mkdir dockerd
cd dockerd
--- End code ---

We now create a file called run
with following contents:
 

--- Code: ---#!/bin/sh
[ -e /run/dbus/system_bus_socket ] || exit 1
exec /usr/bin/dockerd

--- End code ---

Make sure the run file is executable:


--- Code: ---sudo chmod 755 run
--- End code ---

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: ---sudo ln -sv /lib/init/services/dockerd /etc/init/multi/dockerd
--- End code ---

Dockerd service is now up and running

Stop the dockerd example service:

To stop the service you simply remove the link just created.

--- Code: ---sudo rm /etc/init/multi/dockerd
--- End code ---
Note that you simply remove the link and not the script it self

I am Dengesiz Kokarca!

Review and correct by Thierry ;)

Navigation

[0] Message Index

Go to full version