From: "Thomas Tuttle" <gentoo@ttuttle.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] debugging init scripts
Date: Thu, 12 Jul 2007 13:06:43 -0400 [thread overview]
Message-ID: <1184260003.10327.1199851397@webmail.messagingengine.com> (raw)
In-Reply-To: <200707121715.40746.uwix@iway.na>
On Thu, 12 Jul 2007 17:15:40 +0100, "Uwe Thiem" <uwix@iway.na> said:
> On 12 July 2007, Frank Wilson wrote:
> > I'm trying to debug an init script / daemon I'm trying to run. I can't
> > seem to print the debug output to print to a file. For example I
> > enter:
> >
> > /etc/init.d/apache2 restart --debug >> /root/apache2.debug
> >
> > or
> >
> > /etc/init.d/apache2 restart --debug > /root/apache2.debug
> >
> > but I get none of the debug output. Also less insists that
> > /root/apache2.debug is a binary file... not sure why.
>
> First of all, you should do something like "/etc/init.d/apache2
> restart --debug > /root/apache2.debug 2>&1" to catch both, standard and
> error
> output.
Yes, I agree.
> Still, this won't work in your case. The output you usually see on
> screen, is
> *not* generated by the script (or the executing shell) but by the
> commands
> used in the script.
If it's generated by a command used in the script, it will be sent to
the file. stdout is stdout, and if it's redirected to a file in the
shell running the script, it will go to the same place in any commands
run by that shell, unless they reopen it to another file.
> So keep a backup of the original script, then dive into it with your
> favourite
> editor and append ">> /root/apache2.debug 2>&1" to all relevant commands.
I don't think you need to.
At worst, wrap the command in parentheses to run it in a subshell, like
this:
( /etc/init.d/apache2 restart --debug ) > /root/apache2.debug 2>&1
But you shouldn't need that.
Just to get this straight... you're trying to capture the output of the
initscript, not of Apache itself, right?
And as for less thinking it's a binary file, that's because the Gentoo
initscripts change the text color using escape codes, which are
considered binary by less. (Specifically, the escape character, ASCII
27, is probably considered binary.)
Hope this helps,
Thomas Tuttle
--
Thomas Tuttle - ttuttle@ttuttle.net - http://www.ttuttle.net/
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2007-07-12 17:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-12 15:32 [gentoo-user] debugging init scripts Frank Wilson
2007-07-12 16:15 ` Uwe Thiem
2007-07-12 17:06 ` Thomas Tuttle [this message]
2007-07-16 0:07 ` Iain Buchanan
2007-07-16 1:13 ` Ian Hastie
2007-07-16 1:58 ` Iain Buchanan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1184260003.10327.1199851397@webmail.messagingengine.com \
--to=gentoo@ttuttle.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox