[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:slackware_admin:runit [2019/05/29 11:27 (UTC)] – Improvements and clarifications in Chapter 6 chrisabela | howtos:slackware_admin:runit [2019/09/17 04:20 (UTC)] – Reorder the headings and remove numbering. Numbering causes issues when reordering so removed. aaditya | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Runit ====== | ====== Runit ====== | ||
- | ===== 1. Introduction ===== | + | ===== Introduction ===== |
runit is a UNIX init scheme with service supervision. It is a cross-platform Unix init scheme with service supervision, | runit is a UNIX init scheme with service supervision. It is a cross-platform Unix init scheme with service supervision, | ||
Line 11: | Line 11: | ||
To read on the benefits of runit, see here: http:// | To read on the benefits of runit, see here: http:// | ||
- | ===== 2. Use runit with traditional init ===== | + | Unless otherwise stated, all commands in this article are to be run by root. |
+ | |||
+ | ===== Use runit with traditional init (sysvinit) | ||
runit is not provided by Slackware, but a SlackBuild is maintained on https:// | runit is not provided by Slackware, but a SlackBuild is maintained on https:// | ||
Line 29: | Line 31: | ||
</ | </ | ||
- | For a typical Slackware-stlyle service, you can also edit ''/ | + | ==== Starting via rc.local ==== |
+ | |||
+ | For a typical Slackware-stlyle service, you can edit ''/ | ||
< | < | ||
Line 36: | Line 40: | ||
fi | fi | ||
</ | </ | ||
- | |||
- | if you require it. | ||
and then edit write ''/ | and then edit write ''/ | ||
Line 57: | Line 59: | ||
and reboot | and reboot | ||
- | ===== 3. Using runit with sysvinit and inittab | + | ==== Starting via inittab |
Remove the entries in ''/ | Remove the entries in ''/ | ||
Line 77: | Line 79: | ||
or reboot | or reboot | ||
- | ===== 4. How to replace init with runit ===== | + | ===== How to replace init with runit ===== |
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. | ||
- | Remove | + | So, remove |
< | < | ||
Line 87: | Line 89: | ||
</ | </ | ||
- | Reboot: | + | And reboot: |
< | < | ||
Line 184: | Line 186: | ||
However, with the last alternative, | However, with the last alternative, | ||
- | ===== 5. Startup and Shutdown | + | ==== Startup and Shutdown ==== |
The traditional init reads ''/ | The traditional init reads ''/ | ||
Line 215: | Line 217: | ||
However consider that shutdown would not work for the original init. | However consider that shutdown would not work for the original init. | ||
- | ===== 6. runsv ===== | + | ===== runsv ===== |
Although runit may replace init as the PID 1 daemon, there is not much benefit unless other services are migrated from Slackware' | Although runit may replace init as the PID 1 daemon, there is not much benefit unless other services are migrated from Slackware' | ||
Line 225: | Line 227: | ||
</ | </ | ||
- | In order to let the non-privileged | + | As a non-priviliged |
- | + | ||
- | < | + | |
- | chown bob.users / | + | |
- | </ | + | |
- | + | ||
- | As a non-priviliged user, create some directories | + | |
< | < | ||
Line 237: | Line 233: | ||
</ | </ | ||
- | Then edit a script that simulates a (finicky) service in a convenient directory; say | + | Then edit a ''/ |
< | < | ||
Line 263: | Line 259: | ||
</ | </ | ||
- | Edit a file called ''/ | + | Log in back as root and edit a file called ''/ |
< | < | ||
Line 298: | Line 294: | ||
</ | </ | ||
- | Log in as root and run the sv service to ensure that it works: | + | Run the service to ensure that it works: |
< | < | ||
- | su - | ||
/ | / | ||
</ | </ | ||
Line 321: | Line 316: | ||
Hit CTRL+C to exit. | Hit CTRL+C to exit. | ||
- | Finally, let bob take the ownership of the whole ''/ | + | Finally, |
< | < | ||
Line 329: | Line 324: | ||
Now bob can manage this service with the '' | Now bob can manage this service with the '' | ||
- | ===== 7. | + | ===== Managing Services with sv ===== |
To see the status of a supervised service use '' | To see the status of a supervised service use '' | ||
Line 349: | Line 344: | ||
</ | </ | ||
- | ==== 7.1. Stop/ | + | ==== Stop/ |
Start a service | Start a service | ||
Line 383: | Line 378: | ||
Each of these will also return the status of the service upon exit. | Each of these will also return the status of the service upon exit. | ||
- | ==== 7.2. Enabling a service ==== | + | ==== Enabling a service ==== |
Service directories are placed under ''/ | Service directories are placed under ''/ | ||
Line 393: | Line 388: | ||
Once a service is linked it will always start on boot and restart if it stops (unless this is disabled). | Once a service is linked it will always start on boot and restart if it stops (unless this is disabled). | ||
- | ==== 7.3. Disabling a service ==== | + | ==== Disabling a service ==== |
To disable a service in the current runlevel remove the symlink to its service directory from ''/ | To disable a service in the current runlevel remove the symlink to its service directory from ''/ | ||
Line 415: | Line 410: | ||
</ | </ | ||
- | ==== 7.4. Dependencies ==== | + | ==== Dependencies ==== |
Dependencies of service are supported by starting the dependent run script as follows: | Dependencies of service are supported by starting the dependent run script as follows: | ||
Line 427: | Line 422: | ||
</ | </ | ||
- | ===== 8. Runlevels | + | ==== Runlevels ==== |
- | If you installed the slackbuild configuration files, you have two runlevels: default and single. The current runlevel is default. You can verify by looking under ''/ | + | If you installed the slackbuild configuration files, you have two runlevels: default and single. The current runlevel is default. You can verify by looking under ''/ |
Change runlevel to another runlevel; single: | Change runlevel to another runlevel; single: | ||
Line 437: | Line 432: | ||
</ | </ | ||
- | You will see that ''/ | + | You will see that ''/ |
< | < | ||
Line 443: | Line 438: | ||
</ | </ | ||
- | You can create any other runlevel and name them as you like. To start you can copy an existing runlevel directory and modify as you wish. | + | You can create any other runlevel and name them as you like. To start, you can copy an existing runlevel directory and modify as you wish. |
< | < | ||
Line 451: | Line 446: | ||
You can edit the runsvdir line of ''/ | You can edit the runsvdir line of ''/ | ||
- | ===== 9. run scripts ===== | + | ===== Run scripts ===== |
- | Only one executable can be called for a service | + | Only one executable can be called for a service |
In direct contrast to Slackware' | In direct contrast to Slackware' | ||
Line 469: | Line 464: | ||
</ | </ | ||
- | ===== 10. Migrating Services ===== | + | ===== Migrating Services ===== |
It is suggested that services are migrated from stage 2 (which are still under the Slackware' | It is suggested that services are migrated from stage 2 (which are still under the Slackware' | ||
Line 520: | Line 515: | ||
It is stuggested to let '' | It is stuggested to let '' | ||
- | ===== 11. Sources ===== | + | ===== Sources ===== |
(1) http:// | (1) http:// | ||
Line 537: | Line 532: | ||
(8) https:// | (8) https:// | ||
+ | |||
+ | (9) https:// | ||
* Written for Slackware 14.2 in December 2018 | * Written for Slackware 14.2 in December 2018 |