From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1I92DF-0005JR-SH for garchives@archives.gentoo.org; Thu, 12 Jul 2007 17:12:22 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l6CHB9aA020008; Thu, 12 Jul 2007 17:11:09 GMT Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l6CH6jGs015249 for ; Thu, 12 Jul 2007 17:06:46 GMT Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 576409CE4 for ; Thu, 12 Jul 2007 13:06:45 -0400 (EDT) Received: from web5.messagingengine.com ([10.202.2.214]) by compute2.internal (MEProxy); Thu, 12 Jul 2007 13:06:45 -0400 Received: by web5.messagingengine.com (Postfix, from userid 99) id ACB1C22FDA; Thu, 12 Jul 2007 13:06:43 -0400 (EDT) Message-Id: <1184260003.10327.1199851397@webmail.messagingengine.com> X-Sasl-Enc: DnLqIbYVWFa80/Bg8so6UN88sHX+AjkiXAnvkvp0jzm+ 1184260003 From: "Thomas Tuttle" To: gentoo-user@lists.gentoo.org Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface References: <13b70780707120832h3c8200eelc88b644fe9b4f9af@mail.gmail.com> <200707121715.40746.uwix@iway.na> Subject: Re: [gentoo-user] debugging init scripts In-Reply-To: <200707121715.40746.uwix@iway.na> Date: Thu, 12 Jul 2007 13:06:43 -0400 X-Archives-Salt: 03640769-cd22-4e56-a3d9-e5fe7c536049 X-Archives-Hash: e766b9006c30d96a177faec16ecad7c5 On Thu, 12 Jul 2007 17:15:40 +0100, "Uwe Thiem" 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