email myself startup screen messages log

0

I currently have a NAS (Ubuntu 10.04) on my network without an access to a monitor due to a lack of a graphics card. I noticed that every time I restart the NAS, it's been taking longer to fully restart. I suspect that something might be wrong, and the warning or error messages are being displayed during startup.

Is there a log file that Ubuntu prints to for everything that is displayed from the moment the system starts up until the login screen? I have email set up on the system via .mailrc and .mstmprc where I could email out with the mail command. I would like to email myself the log file every time the system starts up so I can monitor the system's health. Please let me know how I could do this.

Vinh Nguyen

Posted 2011-09-11T15:40:47.330

Reputation: 265

try /var/log/messages or /var/log/dmesg – Sirex – 2011-09-11T17:36:35.103

Answers

0

There is such a log file, /var/log/messages, to which the kernel dumps whatever happens on the system.

However, it does get rather large (mine is now 29 megabytes), so make sure that your cron job compresses this file before you ship it out.


In general on a Linux system, custom startup commands are placed into the local file, which can be found under /etc/init.d.

Add to this file the following command (I will probably revise - I don't use mail, personally):

mail -s "Log File" myemail@myserver < /var/log/messages

Make it executable:

sudo chmod +x /etc/init.d/local

And finally, link it into init:

sudo update-rc.d local defaults 80

Reference: Here

new123456

Posted 2011-09-11T15:40:47.330

Reputation: 3 707

Is this file what is printed on the console screen when the system starts up? I took a look, and it doesn't seem so. Showing messages like firewall related stuff (pgl).

How do I set up an email script for every startup? Thanks. – Vinh Nguyen – 2011-09-12T04:21:16.827

@Vinh I belive that the kernel has a debug level system, where only the highest priority messages are shown at boot; this, by contrast, shows everything. As far as emailing yourself, look into writing an init script and installing it.. I'll extract a summary and put it into my answer.

– new123456 – 2011-09-12T11:12:40.383