output to console from init script

Rick Stevens ricks at nerd.com
Mon Nov 29 19:59:57 UTC 2010


On 11/29/2010 11:42 AM, msacks wrote:
> Hello,
> I am trying to figure out a way to output some information to the
> console (system boots to runlevel 3) from an init script.
>
> Here is what I've tried:
> add echo "$SOMEINFO" into the init script and pipe it to wall, and put
> that in the init script.
>
> This doesn't seem to work, I was thinking of outputting to motd to
> achieve this, but wondered if anyone knows a better way.
> Perhaps using the at command?

Er, make sure you have a rule in your /etc/rsyslog.conf that outputs
to the console, then use logger(1) to send the message, e.g.:

(in /etc/rsyslog.conf:)

	local5.*		/dev/console

(in script:)

	logger -p local5.info This is message text

should result in

	date-time hostname root: This is message text

on the console.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, C2 Hosting          ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-      Always remember you're unique, just like everyone else.       -
----------------------------------------------------------------------


More information about the users mailing list