LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Driver startup script not recording output in /var/log/messages. (https://www.linuxquestions.org/questions/linux-software-2/driver-startup-script-not-recording-output-in-var-log-messages-948443/)

jake_the_dog 06-04-2012 08:59 AM

Driver startup script not recording output in /var/log/messages.
 
Hello,

I have modified a start-up script to validate some parameters before loading a driver. However, the output, ( whether or not the parameters are correct ) is not being recorded in /var/log/messages, or anywhere else for that matter. I have tried both echo and logger statements but neither work. The output in the script, for example:

echo "Valid parameters, driver loaded."

IS written to the console during boot-up, but is lost after this. Does anyone understand why the output is not being written anywhere. All output should be written to /var/log/messages but it is not there.

MensaWater 06-04-2012 09:11 AM

Startup scripts by their nature run when not everything else is running. Did you set the startup script to run AFTER the one that starts syslogd?

Also your echo isn't redirecting output anywhere which is why it appears on the console which is the standard output device for startup scripts usually.

You could try changing:
echo "Valid parameters, driver loaded."

to:
echo "Valid parameters, driver loaded." |tee -a /var/log/messages

That would make it show the output on the console AND append it to the /var/log/messages file. (You might have to input full path to tee command for the startup script to find it.)

Also be careful what you put in startup scripts. If you put something there that hangs/never completes it could hang your entire startup at that point.

jake_the_dog 06-04-2012 09:20 AM

Yes I have already tried redirecting the output to a file. I have been told that all of the output printed to the console ( by start-up scripts ) will be recorded in /var/log/messages. I do see my output being printed to the console when I reboot the machine, but I cannot find it logged anywhere in a file once I am on the machine.

echo "Valid parameters, driver loaded." |tee -a /var/log/messages

is equivalent to the 'logger' command, which I have already tried.

MensaWater 06-04-2012 09:55 AM

Somebody has misinformed you. Linux startup scripts are NOT automatically logged to syslog. As I noted before syslog itself is started by one of the startup scripts.

Unfortunately I don't know of any facility in Linux that will log startup scripts automatically. (I got spoiled by HP-UX which logs everything to /etc/rc.log from startup scripts.) "dmesg" will show you many things that happened during startup (and errors after that) but doesn't show everything.

P.S. Since you didn't show a redirect in your echo there was no way for me to know you were doing it.

jake_the_dog 06-04-2012 10:36 AM

Do you have any intuition on why the output is not being logged even after the output has been redirected?

jake_the_dog 06-05-2012 08:39 AM

I believe that my start-up scripts are executing before the kernel logger has loaded. Is there anyway to get any meaningful data out of the scripts some other way?

jake_the_dog 06-05-2012 10:29 AM

Closing thread, this was indeed the problem.


All times are GMT -5. The time now is 02:36 AM.