* [gentoo-user] debugging init scripts @ 2007-07-12 15:32 Frank Wilson 2007-07-12 16:15 ` Uwe Thiem 0 siblings, 1 reply; 6+ messages in thread From: Frank Wilson @ 2007-07-12 15:32 UTC (permalink / raw To: gentoo-user 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. Hope you guys can set me straight! Thanks, Frank -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] debugging init scripts 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 0 siblings, 1 reply; 6+ messages in thread From: Uwe Thiem @ 2007-07-12 16:15 UTC (permalink / raw To: gentoo-user 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. 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. 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. Uwe -- Jethro Tull: Maybe, I am not done yet! -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] debugging init scripts 2007-07-12 16:15 ` Uwe Thiem @ 2007-07-12 17:06 ` Thomas Tuttle 2007-07-16 0:07 ` Iain Buchanan 0 siblings, 1 reply; 6+ messages in thread From: Thomas Tuttle @ 2007-07-12 17:06 UTC (permalink / raw To: gentoo-user 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] debugging init scripts 2007-07-12 17:06 ` Thomas Tuttle @ 2007-07-16 0:07 ` Iain Buchanan 2007-07-16 1:13 ` Ian Hastie 0 siblings, 1 reply; 6+ messages in thread From: Iain Buchanan @ 2007-07-16 0:07 UTC (permalink / raw To: gentoo-user On Thu, 2007-07-12 at 13:06 -0400, Thomas Tuttle wrote: > 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.) it's a funny workaround, but sometimes you have to type cat file | less to stop less being "intelligent". Or you could disable it's input preprocessor: LESSOPEN="" less /usr/bin/echo-client-2 cya, -- Iain Buchanan <iaindb at netspace dot net dot au> All heiresses are beautiful. -- John Dryden -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] debugging init scripts 2007-07-16 0:07 ` Iain Buchanan @ 2007-07-16 1:13 ` Ian Hastie 2007-07-16 1:58 ` Iain Buchanan 0 siblings, 1 reply; 6+ messages in thread From: Ian Hastie @ 2007-07-16 1:13 UTC (permalink / raw To: gentoo-user On Mon, 16 Jul 2007 09:37:26 +0930 Iain Buchanan <iaindb@netspace.net.au> wrote: > it's a funny workaround, but sometimes you have to type > > cat file | less > > to stop less being "intelligent". Or you could disable it's input > preprocessor: > > LESSOPEN="" less /usr/bin/echo-client-2 Or you can use the -L, aka --no-lessopen, switch. It does the same thing, but with less typing... : -L or --no-lessopen : Ignore the LESSOPEN environment variable (see : the INPUT PREPROCESSOR section below). This option can be set from : within less, but it will apply only to files opened subsequently, : not to the file which is currently open. -- Ian. -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] debugging init scripts 2007-07-16 1:13 ` Ian Hastie @ 2007-07-16 1:58 ` Iain Buchanan 0 siblings, 0 replies; 6+ messages in thread From: Iain Buchanan @ 2007-07-16 1:58 UTC (permalink / raw To: gentoo-user On Mon, 2007-07-16 at 02:13 +0100, Ian Hastie wrote: > On Mon, 16 Jul 2007 09:37:26 +0930 > Iain Buchanan <iaindb@netspace.net.au> wrote: > > > it's a funny workaround, but sometimes you have to type > > > > cat file | less > > > > to stop less being "intelligent". Or you could disable it's input > > preprocessor: > > > > LESSOPEN="" less /usr/bin/echo-client-2 > > Or you can use the -L, aka --no-lessopen, switch. It does the same > thing, but with less typing... > > : -L or --no-lessopen > : Ignore the LESSOPEN environment variable (see > : the INPUT PREPROCESSOR section below). This option can be set from > : within less, but it will apply only to files opened subsequently, > : not to the file which is currently open. ahh, thanks. I searched the options for "input preprocessor", but it's formatted "INPUT<space><space>PRE-" in my particular terminal, so less didn't locate a match until the Input Preprocessor seciton, which doesn't mention the option! thanks, -- Iain Buchanan <iaindb at netspace dot net dot au> Matz's Law: A conclusion is the place where you got tired of thinking. -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-07-16 2:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2007-07-16 0:07 ` Iain Buchanan 2007-07-16 1:13 ` Ian Hastie 2007-07-16 1:58 ` Iain Buchanan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox