Difference between revisions of "Short Notes on Linux Administration"

From PaskvilWiki
Jump to: navigation, search
Line 46: Line 46:
 
and then feed this file to <tt>sendmail</tt>:
 
and then feed this file to <tt>sendmail</tt>:
 
<pre>sendmail -t < message_file.txt</pre>
 
<pre>sendmail -t < message_file.txt</pre>
 +
 +
== Find and Mark Bad Blocks ==
 +
 +
<pre>$ sudo backblocks -sv /dev/sdX > ~/bad-blocks-list
 +
$ fsck -l ~/bad-blocks-list /dev/sdX</pre>
 +
You can run the test also just on a partition, simply by selecting <tt>/dev/sdXN</tt> instead of just drive <tt>/dev/sdX</tt>.

Revision as of 02:42, 3 January 2014

Reset Compiz to Default Settings

gconftool-2 --recursive-unset /apps/compiz

and restart.

Enable and Start sendmail

If you're getting "stat=Deferred: Connection refused by [127.0.0.1]" log messages from sendmail, try adding the following line to your /etc/mail/sendmail.mc file:

DAEMON_OPTIONS(`Port=smtp, Addr=127.0.0.1, Name=MTA')

under the "General defines" section.

Also, make sure the sendmail daemon is running:

ps aux | grep sendmail

If not, run it using

sendmail -bd -q1m

where -q parameter chooses how often the email queue's new messages should be processed (here, every minute).

To test if this all works, use

echo -e "Subject: Hello\nTesting the mailer..." | sendmail -f test@test.com myrealaddress@mail.com

The advantage of sendmail over mail is that the from address need not be a valid email address... well... advantage?

Installing sendmail

On most systems, sendmail comes as a package, and typically gets started during the boot from the init.d/rc.d scripts.

If you want/need to start sendmail manually, or it has died, use

sendmail -bd

or, for debugging purposes

sendmail -bD

that will start sendmail daemon, but will keep it in foreground, so you can see its output.

Sending Emails using sendmail

The easiest way is to create the message file with all necessary definitions, e.g.

To: Mr. Recepient <recepient@hosting.com>
Subject: This is a fine example of a subject
Date: 2011-08-15 20:00:00 +0000
From: Mr. Sender <sender@hosting.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
User-Agent: My email service

The body of the message comes here, after a single blank line...

and then feed this file to sendmail:

sendmail -t < message_file.txt

Find and Mark Bad Blocks

$ sudo backblocks -sv /dev/sdX > ~/bad-blocks-list
$ fsck -l ~/bad-blocks-list /dev/sdX

You can run the test also just on a partition, simply by selecting /dev/sdXN instead of just drive /dev/sdX.