Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
try /var/log/messages or /var/log/dmesg –  Sirex Sep 11 '11 at 17:36
add comment

1 Answer

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

share|improve this answer
    
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 Sep 12 '11 at 4:21
    
@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 Sep 12 '11 at 11:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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