Both sides previous revision
Previous revision
Next revision
|
Previous revision
Last revision
Both sides next revision
|
howtos:slackware_admin:runit [2019/09/17 04:20 (UTC)] aaditya Reorder the headings and remove numbering. Numbering causes issues when reordering so removed. |
howtos:slackware_admin:runit [2019/09/21 10:05 (UTC)] aaditya [Run scripts] pkg available now |
To read on the benefits of runit, see here: http://smarden.org/runit/benefits.html | To read on the benefits of runit, see here: http://smarden.org/runit/benefits.html |
| |
Unless otherwise stated, all commands in this article are to be run by root. | //* Unless otherwise stated, all commands in this article are to be run by root.// |
| |
===== Use runit with traditional init (sysvinit) ===== | ===== Use runit with traditional init (sysvinit) ===== |
| |
===== How to replace init with runit ===== | ===== How to replace init with runit ===== |
| |
| runit provides ''runit-init'' which can be used to boot up the system. |
| |
If you followed the previous chapter, then stop runsvdir and reverse all the changes that you made on your system. | If you followed the previous chapter, then stop runsvdir and reverse all the changes that you made on your system. |
==== Startup and Shutdown ==== | ==== Startup and Shutdown ==== |
| |
The traditional init reads ''/etc/inittab'' file to see how to run the system. It runs the ''/etc/rc.d/rc.S'' script and runs it. If set in the default runlevel 3, it follows it with ''/etc/rc.d/rc.M''. In runit the initialisation script is located in ''/etc/runit/1'' for all runlevels. By default ''/etc/runit/2'' is restricted to the TTY services. | The bsd style init scripts provided by Slackware are used to bring up the system. |
| |
| Initially the single user script ''/etc/rc.d/rc.S'' runs. If set in the default runlevel 3, it follows it with ''/etc/rc.d/rc.M''. In runit the initialisation script is located in ''/etc/runit/1'' for all runlevels. By default ''/etc/runit/2'' is restricted to the TTY services. |
| |
The script ''/etc/rc.d/rc.6'' is the rebooting script for the traditional init, while ''/etc/rc.d/rc.0'' (symlinked to the former) is the halting script. In runit, these scripts are called by ''/etc/runit/3'' | The script ''/etc/rc.d/rc.6'' is the rebooting script for the traditional init, while ''/etc/rc.d/rc.0'' (symlinked to the former) is the halting script. In runit, these scripts are called by ''/etc/runit/3'' |
| |
Only one executable can be called for a service (the last line) and it must be called by the ''exec'' command. There are some generic runit run scripts on the Internet and on other Linux distributions. Also, other Slackers may post them on publicly available repositories. The author of this article has placed his here: https://gitlab.com/chrisabela/runit_scripts_for_slackware | Only one executable can be called for a service (the last line) and it must be called by the ''exec'' command. There are some generic runit run scripts on the Internet and on other Linux distributions. Also, other Slackers may post them on publicly available repositories. The author of this article has placed his here: https://gitlab.com/chrisabela/runit_scripts_for_slackware |
| |
| Another set of installable run scripts are available at [[https://slackbuilds.org/repository/14.2/system/runit-services/|SBo]]. |
| |
In direct contrast to Slackware's BSD style service scripts, runit run scripts must not must run in the foreground, otherwise runit would think that they have crashed and restart them. | In direct contrast to Slackware's BSD style service scripts, runit run scripts must not must run in the foreground, otherwise runit would think that they have crashed and restart them. |
</code> | </code> |
| |
Or you can use the ''pause'' command to keep the service alive. ''pause'' is a trivial command that will simply not exit, until it is killed (akin to tail -f /dev/null). A SlackBuild for ''pause'' is available at https://slackbuilds.org Then end the run script with: | Or you can use the ''pause'' command to keep the service alive. ''pause'' is a trivial command that will simply not exit, until it is killed (akin to tail -f /dev/null). A SlackBuild for ''pause'' is available at [[https://slackbuilds.org/repository/14.2/system/pause/|SBo]]. Then end the run script with: |
| |
<code> | <code> |
It is stuggested to let ''udev'' under runit's stage 2, but you can setup its monitoring for stage 3. | It is stuggested to let ''udev'' under runit's stage 2, but you can setup its monitoring for stage 3. |
| |
===== Sources ===== | ===== Using runit-init with other init scripts ===== |
| |
(1) http://smarden.org/runit/ | |
| |
(2) https://slackbuilds.org | ==== OpenRC ==== |
| |
(3) https://en.wikipedia.org/wiki/Init | Here ''runit-init'' is used for booting, which then transfers control to the OpenRC for things like mounting the filesystem, loading modules, running udev, etc. |
| |
(4) https://voidlinux.org/usage/runit/ | It requires a working OpenRC system. Check the [[howtos:general_admin:openrc]] page for instructions. |
| The level 1 runit service uses the OpenRC ''boot'' and ''sysinit'' runlevels. |
| |
(5) https://www.youtube.com/watch?v=jiBlIhFxNJo | The [[https://wiki.gentoo.org/wiki/Runit#Runit_as_the_init_system|gentoo wiki]] has more information, and [[https://gitlab.com/aadityabagga/runit-init-openrc|runit-init-openrc]] details how to install and set it up. |
| |
(6) http://kchard.github.io/runit-quickstart/ | ==== void-runit ==== |
| |
(7) https://www.slackbook.org/beta/ | Here the scripts provided by the [[https://github.com/void-linux/void-runit|void-runit]] project are used to mount the filesystem, load modules, etc. |
| |
| Currently this is the most independent way to setup runit. |
| |
| ===== Sources ===== |
| |
(8) https://gitlab.com/chrisabela/runit_scripts_for_slackware | - http://smarden.org/runit/ |
| - https://en.wikipedia.org/wiki/Init |
| - https://voidlinux.org/usage/runit/ |
| - https://www.youtube.com/watch?v=jiBlIhFxNJo |
| - http://kchard.github.io/runit-quickstart/ |
| - https://www.slackbook.org/beta/ |
| - https://gitlab.com/chrisabela/runit_scripts_for_slackware |
| - https://github.com/aadityabagga/runit-services |
| - https://wiki.gentoo.org/wiki/Runit |
| - https://github.com/void-linux/void-runit |
| |
(9) https://wiki.gentoo.org/wiki/Runit | ---- |
| |
* Written for Slackware 14.2 in December 2018 | * Written for Slackware 14.2 in December 2018 |