[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.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
howtos:slackware_admin:runit [2019/05/29 11:27 (UTC)] – Improvements and clarifications in Chapter 6 chrisabelahowtos:slackware_admin:runit [2019/09/16 06:40 (UTC)] – Typos in Chapter 8 (runevels) are corrected chrisabela
Line 10: Line 10:
  
 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.
  
 ===== 2. Use runit with traditional init ===== ===== 2. Use runit with traditional init =====
Line 81: Line 83:
 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 the last line from ''/etc/inittab''+So, remove the last line from ''/etc/inittab''
  
 <code> <code>
Line 87: Line 89:
 </code> </code>
  
-Reboot:+And reboot:
  
 <code> <code>
Line 225: Line 227:
 </code> </code>
  
-In order to let the non-privileged user (say user bob) run it, change the ownership of the service directory +As a non-priviliged user (say user bob), create some directories:
- +
-<code> +
-chown bob.users /etc/sv/example +
-</code> +
- +
-As a non-priviliged user, create some directories+
  
 <code> <code>
Line 237: Line 233:
 </code> </code>
  
-Then edit a script that simulates a (finicky) service in a convenient directory; say +Then edit a ''/home/bob/runit/service.sh'' script that simulates a (finicky) service in a convenient directory; say 
  
 <code> <code>
Line 263: Line 259:
 </code> </code>
  
-Edit a file called ''/etc/sv/example/run'' and give it executable permissions+Log in back as root and edit a file called ''/etc/sv/example/run'' and give it executable permissions:
  
 <code> <code>
Line 298: Line 294:
 </code> </code>
  
-Log in as root and run the sv service to ensure that it works:+Run the service to ensure that it works:
  
 <code> <code>
-su - 
 /etc/sv/example/run /etc/sv/example/run
 </code> </code>
Line 321: Line 316:
 Hit CTRL+C to exit. Hit CTRL+C to exit.
  
-Finally, let bob take the ownership of the whole ''/etc/sv/example/'' directory:+Finally, login back as root and let bob take the ownership of the whole ''/etc/sv/example/'' directory:
  
 <code> <code>
Line 429: Line 424:
 ===== 8. Runlevels ===== ===== 8. 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 ''/etc/runit/runsvdir/,'' you will see that ''/etc/runit/current'' is a symbolic link ''/etc/runit/default''.+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 ''/etc/runit/runsvdir/,'' you will see that ''/etc/runit/runsvdir/current'' is a symbolic link ''/etc/runit/runsvdir/default/''.
  
 Change runlevel to another runlevel; single: Change runlevel to another runlevel; single:
Line 437: Line 432:
 </code> </code>
  
-You will see that ''/etc/runit/runsvdir/current'' is now symlinked to ''/etc/runit/runsvdir/single'' and ''/etc/runit/runsvdir/previous'' is symlinked to ''/etc/runsvdir/default''. If you reboot, you will boot again default runlevel as you have this entry in ''/etc/runit/2''+You will see that ''/etc/runit/runsvdir/current'' is now symlinked to ''/etc/runit/runsvdir/single'' and ''/etc/runit/runsvdir/previous'' is symlinked to ''/etc/runsvdir/default''. If you reboot, you will boot again on the default runlevel as you have this entry in ''/etc/runit/2''
  
 <code> <code>
Line 443: Line 438:
 </code> </code>
  
-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 startyou can copy an existing runlevel directory and modify as you wish. 
  
 <code> <code>
Line 453: Line 448:
 ===== 9. run scripts ===== ===== 9. run scripts =====
  
-Only one executable can be called for a service and the last line must be called by the ''exec'' command. There are some generic runit run scripts on the Internet, in 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
  
 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.
 howtos:slackware_admin:runit ()