On 8/3/11, Arthur Dent <misc.lists(a)blueyonder.co.uk> wrote:
Wow! really useful advice! Thank You.
As Hiisi says - Tip of the Day and I also agree that syslog+console
should be the default.
Unfortunately, systemd's parallelization of service startup make
output on the console extremely ugly during boot, because several
different commands would output to the screen at the same time and be
all mixed together. There was some talk on systemd-devel of a
curses-based boot screen that neatly organized service startup status
and output but that seems rather pie-in-the-sky at the moment.
That argument is much weaker for syslog though, since it's easily filtered.
However, I just tried this by causing a deliberate error in a
Mod_Security configuration and attempting to restart HTTPD using
systemctl restart httpd.service.
I still only got:
"Job failed. See system logs and 'systemctl status' for details."
at the command line. However, at least now in /var/log/messages I do get
this:
Aug 3 14:06:53 mydomain httpd[1977]: /etc/rc.d/init.d/functions: line 58:
/dev/stderr: No such device or address
Aug 3 14:06:57 mydomain httpd[1977]: Stopping httpd: #033[60G[#033[0;32m
OK #033[0;39m]
Aug 3 14:06:57 mydomain httpd[1988]: /etc/rc.d/init.d/functions: line 58:
/dev/stderr: No such device or address
Aug 3 14:06:59 mydomain httpd[1988]: Starting httpd: #033[60G[#033[0;32m
OK #033[0;39m]
Aug 3 14:10:37 mydomain httpd[2035]: /etc/rc.d/init.d/functions: line 58:
/dev/stderr: No such device or address
Aug 3 14:10:38 mydomain httpd[2035]: Stopping httpd: #033[60G[#033[0;32m
OK #033[0;39m]
Aug 3 14:10:38 mydomain httpd[2043]: /etc/rc.d/init.d/functions: line 58:
/dev/stderr: No such device or address
Aug 3 14:10:38 mydomain httpd[2043]: Starting httpd: Syntax error on line
91 of
/etc/httpd/modsecurity.d/base_rules/modsecurity_crs_20_protocol_violations.conf:
Aug 3 14:10:38 mydomain httpd[2043]: Error creating rule: Unknown variable:
REQBODY_ERROR
Aug 3 14:10:38 mydomain httpd[2043]: #033[60G[#033[0;31mFAILED#033[0;39m]
Aug 3 14:10:38 mydomain systemd[1]: httpd.service: control process exited,
code=exited status=1
Aug 3 14:10:38 mydomain systemd[1]: Unit httpd.service entered failed
state.
Which tells me exactly what I want to know.
Thank You.
I presume that the reason I got no output to the console was because of
the problem with /etc/rc.d/init.d/functions. Lines 56-62 say:
if [ -z "${CONSOLETYPE:-}" ]; then
if [ -r "/dev/stderr" ]; then
CONSOLETYPE="$(/sbin/consoletype < /dev/stderr)"
else
CONSOLETYPE="$(/sbin/consoletype)"
fi
fi
How can I fix this?
I get the same error, but it appears to be harmless; console output
WORKSFORME. Perhaps you're expecting output in xterm? Console ==
/dev/console (which usually == tty1), not the tty you happen to be
running systemctl on. You can redirect output to an arbitrary tty but
only on a per-unit basis. (In fact, this discussion has put a crazy
notion in my head to use that functionality in a script that makes
debugging services easier.)
(Although I am a much happier bunny already!)
Thanks again
Mark