[CentOS] Launch many scripts with reboot

Les Mikesell lesmikesell at gmail.com
Thu Feb 11 14:52:22 UTC 2010

Georghy wrote:
>> Do these need to run as root?  And do they really need to wait for a user to log 
>> in or can they write their output to a file to be viewed later?  You can put a 
>> line in /etc/rc.d/rc.local to run your script which you can change each time as 
>> you want.  And you can add >>/path/to/logfile on the command if you want it to 
>> be saved.   If you want something to run as the user at login, it can go in 
>> .profile or .bash_profile in the user's home directory.
> I use .bash_profile and it works great
> for now i want to display the computer IP adress just before the user login
> my command is :
> ifconfig | grep "inet addr" | awk '{print $2}' | sed s/addr:// | head -n 1
> and it works after logon
> but I want to display it before the user logon
> do you know how to do this ?

The same commands work but the hard part is knowing where to display before 
someone logs in.  Is this a text console or do you have a graphic login box showing?

And by the way, you don't need a pipeline of 4 commands to grab a bit of text. 
Sed can do everything that grep does and more, awk can do anything sed can do. 
If you use one of the more powerful commands you might as well let it do all the 
work instead of building a pipeline.

   Les Mikesell
    lesmikesell at gmail.com

More information about the CentOS mailing list