Editing
Util-vserver:InitStyles
(section)
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Using runit === [http://smarden.org/runit/ runit] is an init replacement that provides service monitoring. There currently are at least three ways to use it with vserver: * Set initstyle to plain; this allows you to launch your own <tt>runit</tt> inside the vserver. ** This is the most straightforward way. Guests can shut themselves down and restart as usual. Disadvantage: once extra runit-init process per guest. * Use a persistent context for the guest, and just run the services inside it, not runit itself. This is discussed in [[Running runit-supervised services inside a vserver]]. * Set initstyle to <tt>sysv</tt>, but <tt>cmd.start</tt> to "<tt>/etc/runit/2</tt>" and <tt>cmd.stop</tt> to "<tt>/etc/runit/3</tt>". ** Advantage: you can run a vserver supervised by <tt>runit</tt> running on the host. For this to work, you must customize <tt>/etc/runit/2</tt> in the vserver as follows: <pre> #!/bin/sh trap ":" HUP INT QUIT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin runsvchdir default >/dev/null env - PATH=$PATH \ runsvdir -P /var/service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' exec /etc/runit/3 </pre> Now, you can set up a <tt>runit</tt> service on the host with a <tt>run</tt> script like this one: <pre> #!/bin/sh exec 2>&1 exec vserver name-of-vserver start </pre> This way: * <tt>vserver start</tt> doesn't exit until <tt>runsvdir</tt> terminates. * If <tt>runsvdir</tt> terminates, all services running inside the vserver are stopped. * <tt>vserver stop</tt> works as expected. ** Update: with util-vserver 0.30.212 on amd64, it doesn't. The signal never reaches <tt>runsvdir</tt>. * You can control the vserver using <tt>sv</tt> like any other service, provided all processes running inside it are managed by <tt>runit</tt>. ** If there are processes left inside after all the services exited, <tt>runit</tt> running on the host won't be able to restart the vserver until those stray processes are killed somehow. ** You may want to add something to this effect to the <tt>finish</tt> script of the vserver service, but it may not be a good idea. Be sure you know what you are doing, as always. Still, this may not be the best way to integrate <tt>runit</tt> with vserver. [[Running runit-supervised services inside a vserver]] may be better if you only run a specific service in a guest and it seems wasteful to keep extra processes around. Using the plain initstyle and starting runit-init in each guest is best if you want to make your guests behave like a physical system. It's also the most hassle-free approach. --[[User:KornAndras|Guy-]] 02:30, 2 February 2007 (CET) [[Category:Configuration]]
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information