LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Redirect console out put to a file (https://www.linuxquestions.org/questions/linux-newbie-8/redirect-console-out-put-to-a-file-520307/)

procfs 01-17-2007 06:34 PM

Redirect console out put to a file
 
HI

I am tring to capture the console out put to a file so used

service smb restart > 123 2>&1

but there are some ICMP errors that comes on the screen but not in to the file 123.

How am I to captute all that is commings on to console


Thank you

Regards

Asanka

Rickead2000 01-17-2007 06:48 PM

Simply

Code:

service smb restart > 123
Would store the input from service smb restart into the file 123

pixellany 01-17-2007 06:55 PM

I would have thought that OP's version would work.

BUT--does smb restart produce any output?? What happens if you just run it without any redirection?

unSpawn 01-17-2007 07:13 PM

and are you sure those ICMP messages are generated by Samba and not say the kernel?

bigrigdriver 01-17-2007 07:51 PM

Would

service smb restart | tee 123

also produce the desired result?

It would show the output on standard output, as well as write the output to file 123.

procfs 01-17-2007 08:23 PM

I started the samba after putting !/bin/bash -x in /etc/init.d/smb so I get lots of debuging info. That info I can capture in a file but at the time of shutdown and start of samb I get a ICMP error that part wold not go to the file

Thing is I get this ICMP errors all the time on my console. I want to know why. If I can redirect the out put at least to submit a report.

Jan 14 04:03:00 avadbasvl1 kernel: 172.16.84.129 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.85.4 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.85.5 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.84.236 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.84.137 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.87.207 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.85.11 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.85.10 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0
Jan 14 04:03:00 avadbasvl1 kernel: 172.16.84.139 sent an invalid ICMP type 3, code 3 error to a broadcast: 172.16.87.255 on bond0


Thank you all

Regards

Asanka

unSpawn 01-18-2007 06:26 AM

I started the samba after putting !/bin/bash -x in /etc/init.d/smb so I get lots of debuging info.
No, that would get you the debug info for the script itself. If you want to debug the SMB daemon binary you would need to attach strace (or have debuginfo packages installed IIRC). If you want to debug the SMB process (which you do) you should start smbd with the appropriate "-d" flag ('man 8 smbd'?).


at the time of shutdown and start of samb I get a ICMP error (..) Thing is I get this ICMP errors all the time on my console. I want to know why.
These are not smbd errors but kernel warnings. Where kernel warnings are logged depends on your /etc/syslog.conf. How much of kernel warnings are logged to the screen depends on your dmesg ('man 8 dmesg'?) settings. Putting "dmesg -n 4" in your shells' login script should make them disappear from the screen.

procfs 01-18-2007 11:29 PM

Hi unSpawn

Cam you tell me why is these messages are comming on the console. This is the first time I got these messages.

This happends only if the samba is running

Asanka


All times are GMT -5. The time now is 12:09 AM.