Difference between revisions of "util-vserver:Logging"

From Linux-VServer

Jump to: navigation, search
 
 
(2 intermediate revisions by one user not shown)
Line 3: Line 3:
 
Where is the startup output of vservers going?
 
Where is the startup output of vservers going?
  
* when using init styles others than "plain" (for example without any style setting):
+
==== (A) when using vserver init styles others than "plain": ====
  
** "vserver <name> start" will not do any redirection, thus print to the current output.
+
(for example without any /etc/vservers/<name>/apps/init/style setting)
  
** "/etc/init.d/vservers start" will typically run <tt>lib/util-vserver/vserver-wrapper</tt> which will redirect stdin/out/err from/to the value at /etc/vservers/guest/apps/init/tty, /etc/vservers/.defaults/apps/init/tty or if neither is set, /dev/null. NOTE: just linking to a normal file will log to that file, but currently also open stdin from that file, which may have bad consequences if some programs actually reads from stdin (it may even create an endless loop appending and reading from the file).
+
* "vserver <name> <command>" by itself will not do any redirection, thus print and read to/from the current terminal/whatever.
 +
 
 +
* <tt>/etc/init.d/vservers</tt> will typically run <tt>lib/util-vserver/vserver-wrapper</tt> which will redirect stdin/out/err from/to the value at <tt>/etc/vservers/guest/apps/init/tty</tt>, <tt>/etc/vservers/.defaults/apps/init/tty</tt> or if neither is set, /dev/null. NOTE: just linking to a normal file will log to that file, but currently also open stdin from that file, which may have bad consequences if some programs actually reads from stdin (it may even create an endless loop appending and reading from the file). (<tt>pflanze</tt> has started looking into changing this (opening stdin from /dev/null if the link is pointing to a file) but has run out of energy right now.)
 +
 
 +
You have to keep this in mind: if for some reason a vserver does not start upon host reboot, but starts without problems with "vserver <name> start", that could be because a program in your vserver's scripts/* directory depends on having access to a terminal. This is (like it is with every system service) one of the differences between starting vservers from host's init process or from a login shell (others being resource limits and environment variables).
 +
 
 +
==== (B) when using vserver init style "plain" ====
 +
 
 +
(what is different to (A)? to be investigated/documented)
 +
 
 +
[[Category:Configuration]]

Latest revision as of 22:17, 21 October 2011

[edit] Accessing vserver startup output

Where is the startup output of vservers going?

[edit] (A) when using vserver init styles others than "plain":

(for example without any /etc/vservers/<name>/apps/init/style setting)

  • "vserver <name> <command>" by itself will not do any redirection, thus print and read to/from the current terminal/whatever.
  • /etc/init.d/vservers will typically run lib/util-vserver/vserver-wrapper which will redirect stdin/out/err from/to the value at /etc/vservers/guest/apps/init/tty, /etc/vservers/.defaults/apps/init/tty or if neither is set, /dev/null. NOTE: just linking to a normal file will log to that file, but currently also open stdin from that file, which may have bad consequences if some programs actually reads from stdin (it may even create an endless loop appending and reading from the file). (pflanze has started looking into changing this (opening stdin from /dev/null if the link is pointing to a file) but has run out of energy right now.)

You have to keep this in mind: if for some reason a vserver does not start upon host reboot, but starts without problems with "vserver <name> start", that could be because a program in your vserver's scripts/* directory depends on having access to a terminal. This is (like it is with every system service) one of the differences between starting vservers from host's init process or from a login shell (others being resource limits and environment variables).

[edit] (B) when using vserver init style "plain"

(what is different to (A)? to be investigated/documented)

Personal tools