Tuesday, October 11, 2011

let's send fakemail!

telnet yourmailhost.yourdomain 25
Once connected, helo . Often you'll need to identify your sending host if you've restricted sending host.
helo yourmachine.yourdomain
Tell the system who is sending the mail to to whom the message is addressed.
mail from: you@yourdomain
rcpt to: testaddress@yourdomain
Place content in the body of the message by entering data on a single line, and terminating the data stream by entering a period (.) on single line.
data 

some test text

. 
End the session my typing quit on a single line or using the control-sequence identified by the mail host.

Wednesday, October 5, 2011

scrambled mysql databases for breakfast

I really don't like corrupt databases. They just ruin my day and I really hate scrambled mysql databases for breakfast. However, sometimes corrupt databases are really just the result of problematic indexes. To check those indices... Stop the mysql database daemon...
/etc/init.d/mysqld stop
Don't forget to lsof and check for any hanging processes or inode access.
lsof |grep mysql
Then go to the directory in which you have your mysql database files, say
/var/lib/mysql
Within the directory, check the tables:
myisamchk *.MYI
Then repair the tables:
myisamchk -r *.MYI
After all is said and done, restart mysql...
/etc/init.d/mysqld start
A caveat, however, you need to have as much disk space free on the disk on which you have your database that you're doing your repairs. So, if you have a 50GB database, you'll need to have at least 50GB free. Oh yes. However, if you want to play it fast and loose and do a live check, use mysqlcheck.
mysqlcheck db
Then repair the database tables:
mysqlcheck -r db