LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-10-2015, 06:32 AM   #1
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Rep: Reputation: Disabled
Setting echo routing to file


Hi,

Is this possible to route echo output to standard file? This has to be done by default so that we don't see any echo messages on console.

This should be done only for echo with strings, if echo is acting on devices (e.g. echo 0 > /sys/class/pwm/), it should proceed as it is.

Thanks.
 
Old 03-10-2015, 06:47 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,226

Rep: Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834
you can write for example exec > /tmp/logfile
and echo whatever and anything else will be put into that logfile instead of printing on the screen. (see man bash and redirection). Remember, that will not redirect error messages, you need to write exec 2>/tmp/logfile2 to catch that.
 
1 members found this post helpful.
Old 03-10-2015, 07:10 AM   #3
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thanks, it helped to some extent. But still I see some logs like below:

During bootup:
---------------
starting pid 1423, tty '': '/etc/rc.d/rcS'
Mounting /proc and /sys
Starting the hotplug events dispatcher udevd
Synthesizing initial hotplug events
Running sysctl
Setting up networking on loopback device:

During reboot:
----------------
umount: tmpfs busy - remounted read-only
umount: can't umount /dev/pts: Invalid argument
umount: ubi1:user busy - remounted read-only
umount: can't remount rwfs read-only
umount: can't remount rwfs read-only
umount: can't umount /mnt/rwfs: Invalid argument
umount: can't umount /dev/shm: Invalid argument
umount: devtmpfs busy - remounted read-only
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
 
Old 03-10-2015, 07:14 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,226

Rep: Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834Reputation: 6834
why do you need that? I do not think that can be easily solved
 
Old 03-10-2015, 07:40 AM   #5
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled
I am trying to disable all the logs on serial port as it will be used for printer. Tried to use "console=null", but it is having some issues, so checking other methods.

FYI. This is based on ARM project for embedded product.
 
Old 03-10-2015, 08:14 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Would that be "console=/dev/null" rather than "console=null" ?
And you also might try "earlycon=/dev/null".
Another possibility is "loglevel=0".
 
1 members found this post helpful.
Old 03-11-2015, 03:47 AM   #7
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled
I tried "console=/dev/null", no logs seen. If we do "echo Hello > /dev/ttyXYZ" no prints are coming on UART port.
Adding "earlycon=/dev/null" and "loglevel=0" didn't make any difference.
 
Old 03-11-2015, 05:47 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by rajendrabani View Post
I tried "console=/dev/null", no logs seen. If we do "echo Hello > /dev/ttyXYZ" no prints are coming on UART port.
Adding "earlycon=/dev/null" and "loglevel=0" didn't make any difference.
So setting console=/dev/null worked for you?
 
Old 03-11-2015, 08:07 AM   #9
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled
Yes, no logs are seen. So with respect to disabling logs, it is perfect.

After that I try to print something on serial port, nothing is seen. Is this sending all UART output to /dev/null?
 
Old 03-11-2015, 10:21 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
No - it is more likely that the UART isn't configured for the right speed/start or stop bits/parity/noparity/7bit/8bit...
 
Old 03-13-2015, 07:38 AM   #11
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled
Yes you are right. If I invoke getty and then try, it works fine. Not sure if there are any other ways to init serial than getty.
 
Old 03-13-2015, 08:12 AM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It is the easiest way - but "stty --file=/dev/ttyXXX sane" does the same thing without initiating the login.
 
Old 03-18-2015, 12:20 AM   #13
rajendrabani
LQ Newbie
 
Registered: Mar 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thank you very much Pollard, it worked!
First I tried with "", since I didn't see echo prints on terminal, added baud rate setting as: stty -F /dev/ttymxc1 115200, then it worked!

It is my first post in forum and very happy with outcome Thanks to all!
 
  


Reply


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
[SOLVED] create file with touch and echo output to that file sachin.davra Linux - Newbie 5 01-16-2014 02:28 AM
Wrong ICMP echo routing andrei.wap Linux - Networking 1 12-21-2011 02:20 PM
[SOLVED] Cant echo to file dillbyrne Programming 2 07-24-2011 06:03 PM
change echo default setting to -e in Etch fangorn Debian 1 03-13-2007 09:42 AM
setting up routing need help anonymous411 Linux - Networking 2 05-09-2003 12:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:38 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration