0

It is commonly know, that for some script being executed after logging in, one must write path to the script in /etc/rc.local

My Raspberry Pi (OS - Raspbian Jessie ) boots to prompt mode and many messages are printed, so when I got control via command line I have many lines on my monitor. I want to clear it, like I run

clear

in prompt. I added this line to /etc/rc.local but it has no effect.. How can I clean up all the lines automatically after booting? And why sometimes scripts do not work eventhough they have been added to /etc/rc.local, what is alternative simple solution in this case?

  • rc.local is more analogous to the autoexec.bat on old windows/dos system - it is the last thing run during the initialization/boot process. – ivanivan Jul 20 '17 at 13:40
3

It is commonly known that for some script being executed after logging in, one must write path to the script in /etc/rc.local.

No, that's false and is not commonly known at all. Aside from the fact that /etc/rc.local is a double backwards compatibility mechanism for a bootstrap system that has been superseded twice over, or even three times over, on most current operating systems, that one should really forget about; there's also the detail that /etc/rc.local does not execute after logging in. /etc/rc.local is not even executed connected to a terminal with some operating systems' backwards compatibility mechanisms.

What executes after TUI login varies according to what shell you are using, and in what mode you are using it. The Bourne Again and Z shells source a whole bunch of profile scripts, varying according to what compatibility modes that are invoked in. The Korn and Debian Almquist shells source /etc/profile and $HOME/.profile. For the C shells, it is /etc/csh.login, $HOME/.login, et al..

But although you could put a clear somewhere in there, those aren't really what you want; because that does not clear the terminal before displaying the login prompt, leaving you with a clear terminal that has the login prompt at the top ready for you to log on.

Ironically, the world wants you to clean your screen and tries quite hard to force you to do so. Your system has gone to some length to turn all this off. For starters: You must have used non-default options to stop, for example, mingetty from clearing the terminal before it issues the login prompt, which is its default behaviour. You must have turned off the systemd settings that reset and deallocate the terminal devices for terminal log-on services, too.

So the easiest path to what you want is to turn at least one of those back on again. Take out the --noclear option to mingetty. Use TTYReset=yes. ☺

Further reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.