useinit.html (3101B)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 2 <html> 3 <head> 4 <title>runit - use with traditional init</title> 5 </head> 6 <body> 7 <a href="http://smarden.org/pape/">G. Pape</a><br> 8 <a href="index.html">runit</a><br> 9 <hr> 10 <h1>runit - use with traditional init</h1> 11 <hr> 12 It's possible to use <i>runit</i>'s service supervision without replacing 13 the <i>init</i> scheme of the system. 14 Simply run the <i>stage 2</i> of <i>runit</i> as a service with your 15 current <i>init</i>. 16 <p> 17 Normally this is done by either adding an entry for 18 <tt>/sbin/runsvdir-start</tt> to <tt>/etc/inittab</tt>, or by adding 19 <tt>/sbin/runsvdir-start</tt> as command to </tt>/etc/rc.local</tt>, or by 20 adding <tt>/sbin/runsvdir-start</tt> to the system's <tt>StartupItems</tt>. 21 <p> 22 In any case, you first need to copy the <i>stage 2</i> script to 23 <tt>/sbin/runsvdir-start</tt>, and create the services directory 24 <tt>/service/</tt>: 25 <pre> 26 # install -m0750 /package/admin/runit/etc/2 /sbin/runsvdir-start 27 # mkdir -p /service 28 </pre> 29 <hr> 30 <a href="#sysv">How to use with sysvinit and inittab</a><br> 31 <a href="#upstart">How to use with sysvinit and upstart</a><br> 32 <a href="#bsd">How to use with *BSD init</a><br> 33 <a href="#macosx">How to use with MacOSX init</a> 34 <hr> 35 <a name="sysv"><h2>Using with sysvinit and inittab</h2></a> 36 If your system uses a sysvinit alike init scheme with a <tt>/etc/inittab</tt> 37 file, do: 38 <pre> 39 # cat >>/etc/inittab <<EOT 40 SV:123456:respawn:/sbin/runsvdir-start 41 EOT 42 </pre> 43 and tell <i>init</i> to re-read its configuration, e.g.: 44 <pre> 45 # init q 46 </pre> 47 <hr> 48 <a name="upstart"><h2>Using with sysvinit and upstart</h2></a> 49 If your system uses a sysvinit alike init scheme that utilizes upstart 50 instead of inittab, and which has start and stop scripts located in 51 <tt>/etc/init/</tt>, do: 52 <pre> 53 # cat >/etc/init/runsvdir.conf <<\EOT 54 # for runit - manage /usr/sbin/runsvdir-start 55 start on runlevel 2 56 start on runlevel 3 57 start on runlevel 4 58 start on runlevel 5 59 stop on shutdown 60 respawn 61 exec /usr/sbin/runsvdir-start 62 EOT 63 </pre> 64 and tell init to start the new service, e.g.: 65 <pre> 66 # start runsvdir 67 </pre> 68 <hr> 69 <a name="bsd"><h2>Using with *BSD init</h2></a> 70 If your system uses a BSD alike init scheme with a <tt>/etc/rc.local</tt> 71 script, do: 72 <pre> 73 # cat >>/etc/rc.local <<EOT 74 csh -cf '/sbin/runsvdir-start &' 75 EOT 76 </pre> 77 and reboot your system. 78 <hr> 79 <a name="macosx"><h2>Using with MacOSX init</h2></a> 80 On MacOSX 10.2 create an entry for <i>runit</i> in 81 <tt>/System/Library/StartupItems/</tt>: 82 <pre> 83 # cd /System/Library/StartupItems 84 # mkdir -p runit 85 # cp -p /package/admin/runit/etc/macosx/StartupItems/* runit/ 86 </pre> 87 and reboot your system. 88 <p> 89 On MacOSX 10.4 create an entry for <i>runit</i> in 90 <tt>/Library/LaunchDaemons/</tt>, and tell <i>launchd</i> to start the new 91 service: 92 <pre> 93 # cp /package/admin/runit/etc/macosx/org.smarden.runit.plist \ 94 /Library/LaunchDaemons/ 95 # launchctl load /Library/LaunchDaemons/org.smarden.runit.plist 96 </pre> 97 <hr> 98 <address><a href="mailto:pape@smarden.org"> 99 Gerrit Pape <pape@smarden.org> 100 </a></address> 101 </body> 102 </html>