LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 05-07-2008, 06:29 AM   #1
harryhaller
Member
 
Registered: Sep 2004
Posts: 429

Rep: Reputation: Disabled
Is there any way to log startup messages without making stdout >> file ?


This is an old problem: not all messages by any means are logged to /var/log - they just appear on the console.

Before going through all the rc.x scripts and changing each command to ">> log-file 2>&1" , I was wondering if anyone had a better idea.

As we all know, the messages on the console disappear as soon one switches to another console or logs in on the startup console.

Last edited by harryhaller; 05-07-2008 at 09:08 AM. Reason: correction: changed &2>&1 to 2>&1
 
Old 05-07-2008, 06:40 AM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
Sure, you can output all messages to a remote tty.
 
Old 05-07-2008, 07:57 AM   #3
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
Before going through all the rc.x scripts and changing each command to ">> log-file &2>&1" , I was wondering if anyone had a better idea.
Shouldn't that be "2>&1" ?

Must admit I've done this to the rc.inet1 scripts, sticking "set -x" all over the place to fix my wireless problems.
 
Old 05-07-2008, 09:06 AM   #4
harryhaller
Member
 
Registered: Sep 2004
Posts: 429

Original Poster
Rep: Reputation: Disabled
Quote:
Shouldn't that be "2>&1" ?
Most definitely. Sorry for the typo - has been corrected.

There is a command called tee which outputs stdin to file and stdout.

Unfortunately if the script is testing for a return code - tee will interfere - the return code will be that of tee and not the command - so I have read.

In any case it still means changing all the rc. scripts.

Last edited by harryhaller; 05-07-2008 at 09:09 AM.
 
Old 06-11-2011, 12:19 PM   #5
j_kubik
LQ Newbie
 
Registered: Aug 2010
Posts: 16

Rep: Reputation: 1
This thread is a bit old, but i hope somebody will still find it useful

I am currently experimenting with changing inittab entriels from

Code:
si::sysinit:/etc/rc.d/init.d/rc sysinit

l0:0:wait:/etc/rc.d/init.d/rc 0
l1:1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
to something like

Code:
si::sysinit:/bin/bash -c "/etc/rc.d/init.d/rc sysinit 2>&1 > /var/log/init.log"

l0:0:wait:/bin/bash -c "/etc/rc.d/init.d/rc 0 >> /var/log/init.log 2>&1"
l1:1:wait:/bin/bash -c "/etc/rc.d/init.d/rc 1 >> /var/log/init.log 2>&1"
l2:2:wait:/bin/bash -c "/etc/rc.d/init.d/rc 2 >> /var/log/init.log 2>&1"
l3:3:wait:/bin/bash -c "/etc/rc.d/init.d/rc 3 >> /var/log/init.log 2>&1"
l4:4:wait:/bin/bash -c "/etc/rc.d/init.d/rc 4 >> /var/log/init.log 2>&1"
l5:5:wait:/bin/bash -c "/etc/rc.d/init.d/rc 5 >> /var/log/init.log 2>&1"
l6:6:wait:/bin/bash -c "/etc/rc.d/init.d/rc 6 >> /var/log/init.log 2>&1"
This should redirecto output to a file - but you will lose it from your screen, so if you also want to keep it there you can use tee instead. Generated log file contains some terminal control codes in my case, so best way to read it is just to cat it to terminal - this way colors are preserved

Remember also to make sure that your main filesystem is writable from the start of the init - i changed my grub kernel option from ro to rw - it is genrally not a good idea to keep it that way, so after you check your log file you should change it back to ro.

Last edited by j_kubik; 06-11-2011 at 12:44 PM.
 
Old 06-23-2011, 08:09 PM   #6
harryhaller
Member
 
Registered: Sep 2004
Posts: 429

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by j_kubik View Post
This thread is a bit old, but i hope somebody will still find it useful
Yes, it is definitely useful. Thanks.

The only blemish, as you point out, is that the file system has to be loaded as rw, rather than ro.
 
Old 06-24-2011, 02:25 AM   #7
Ramurd
Member
 
Registered: Mar 2009
Location: Rotterdam, the Netherlands
Distribution: Slackwarelinux
Posts: 545

Rep: Reputation: 74
You may also want to check out /etc/syslog.conf ; read the fitting manual pages for them first: man syslogd and man syslog.conf
 
Old 06-24-2011, 02:04 PM   #8
j_kubik
LQ Newbie
 
Registered: Aug 2010
Posts: 16

Rep: Reputation: 1
syslog is a nice thing to check out, but as I noticed, logging application must be written to specifically log using syslogd. Many init scripts just print messages via standard output, which goes only to terminal. I guess that was the original question that started this thread.
 
Old 06-25-2011, 07:32 PM   #9
harryhaller
Member
 
Registered: Sep 2004
Posts: 429

Original Poster
Rep: Reputation: Disabled
Well, it is an old thread, but I've "more or less" solved it by putting /sbin/logd at the beginning of /etc/rc.d/rc.S.

http://linux.die.net/man/8/logd

Last edited by harryhaller; 06-25-2011 at 07:38 PM.
 
  


Reply

Tags
boot, logging


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vncserver startup error messages in log keimdf Linux - Software 7 08-22-2007 08:56 PM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 06:39 PM
outputting firewall messages to a file instead if stdout schatoor Linux - Networking 2 06-25-2004 11:40 AM
squid messages in the startup log hiplainsdrifter Linux - Networking 1 05-04-2004 03:22 AM
syslog and firestarter - log messages to another file than messages mule Linux - Newbie 0 08-07-2003 03:35 AM


All times are GMT -5. The time now is 10:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration