Simple Guide To Use The Runit Init System
What's Runit System?
runit is a boot system for Unix-like systems such as Linux. Its main function is to start and manage the processes that are part of the operating system.:
Why some system's like Void linux use the runit?
-
Simplicity: Runit is known for its simplicity and minimalist desig- He focuses on doing the basics and doing them well.
-
Managed Processes: Runit is used to start, stop and restart processes on the syste- This includes services, daemons, and other background programs.
-
Dependencies: It can handle dependencies between services, which means you can configure it to start services in the correct order, taking into account the dependencies between them.
-
Easy Configuration: Runit configuration is generally done through simple directories and scripts, making it accessible even to less experienced system administrators.
-
Alternative to Systemd: Some systems prefer runit over systemd, especially those that value simplicity and transparency in initialization and service management.
How i can use that thing?
- Before uploading a service it is necessary to enable it so that it can be activated at boot time and can be managed by the sv command, to enable a service with runit run:
$ ln -s /etc/runit/sv/<Name Of Your Service> /run/runit/service
Controlling the service
Note: When the service is enabled it starts automatically
sv start <Name Of Your Service>
- To stop him:
sv stop <Name Of Your Service>
- To check its status
sv status <Name Of Your Service>
- To restart it
sv restart <Name Of Your Service>
Disabling service at boot
- To disable access at boot simply create a file called *down* in the program folder in question, example:
touch /etc/runit/sv/<Name Of Your Service>/down
Monitoring the system
- View the status of all services
sv status /var/service/*
Seeing boot tree
First install the tree command from your package manager and then
tree /etc/runit/sv/servicedir
You will see output similar to:
servicedir
├── run (755)
├── check (755)
├── conf (644)
├── finish (755)
└── log (directory)
├── config (644)
└── run (755)