Using myisamchk for Crash Recovery in cPnael
If you run mysqld with external locking disabled (which is the default), you cannot reliably use myisamchk to check a table when mysqld is using the same table.
If the server is run with external locking enabled, you can use myisamchk to check tables at any time. In this case, if the server tries to update a table that myisamchk is using, the server will wait for myisamchk to finish before it continues.
If you use myisamchk to repair or optimize tables, you must always ensure that the mysqld server is not using the table (this also applies if external locking is disabled). If you do not stop mysqld, you should at least do a mysqladmin flush-tables before you run myisamchk. Your tables may become corrupted if the server and myisamchk access the tables simultaneously.
When performing crash recovery, it is important to understand that each MyISAM table tbl_name in a database corresponds to the three files in the database directory shown in the following table.
File Purpose
tbl_name.frm Definition (format) file
tbl_name.MYD Data file
tbl_name.MYI Index file
Each of these three file types is subject to corruption in various ways, but problems occur most often in data files and index files.
myisamchk works by creating a copy of the .MYD data file row by row. It ends the repair stage by removing the old .MYD file and renaming the new file to the original file name.
This does a complete and thorough check of all data (-e means “extended check”). It does a check-read of every key for each row to verify that they indeed point to the correct row. This may take a long time for a large table that has many indexes. Normally, myisamchk stops after the first error it finds. If you want to obtain more information, you can add the -v (verbose) option. This causes myisamchk to keep going, up through a maximum of 20 errors.
Reference: http://dev.mysql.com/
SSH Security On cPanel Servers.
1. Change SSH port number.
Edit your ssh configuration file under /etc/ssh/sshd_config and add/replace this line:
# What ports, IPs and protocols we listen for
Port 22
2. Allow only the IP’s that you would like to have access to SSH through your firewall.
iptables -A INPUT -i eth0 -s 192.168.1.1 -p tcp –dport 22 -j ACCEPT
3. Use a utility like BFD, BlockHosts and DenyHosts
denyhosts - a utility to help system admins thwart ssh crackers
4. Use iptables to limit the rate of incoming connections to SSH.
iptables -I INPUT -p tcp –dport 22 -i eth0 -m state –state NEW -m recent –update –seconds 60 –hitcount 4 -j DROP
This will limit incoming connections to port 22 to no more than 3 attempts in a minute. Any more will be dropped.
Managing an Exim 4 server.
Remove mails by ID.
/usr/sbin/exim -v -Mrm (MAIL ID HERE)
List queded mails.
Output the number of queded mails.
Delete frozen mails.
/usr/sbin/exim -bp | awk ‘$6~”frozen” { print $3 }’ | xargs exim -Mrm
Deliver forcefully emails.
/usr/sbin/exim -qff -v -C /etc/exim.conf &
Freeze Mails from the sender.
/usr/sbin/exiqgrep -i -f (MAIL ADDRESS HERE) | xargs exim -Mf
Remove mails from the sender.
/usr/sbin/exiqgrep -i -f (MAIL ADDRESS HERE) | xargs exim -Mrm
Files in /var/spool/exim/msglog contain logging information for each message and are named the same as the message-id.
Exim includes a utility that is quite nice for grepping through the queue, called exiqgrep.
http://www.exim.org/exim-html-4.50/doc/html/spec_49.html#IX2895
Reference: http://www.exim.org/
Creating a Rewrite for Ruby on Rails Application in cPanel
Ruby on Rails uses its own server, users visiting your Ruby on Rails application will need to be redirected to the appropriate port.
Because Ruby on Rails uses its own server, users visiting your website (and subsequently your Ruby on Rails application) will need to be redirected to the appropriate port.
Ruby does not respond on the standard HTTP port number, 80. Thus, visitors would need to specify the port number with the domain — for example, example.com:12001.
To configure a rewrite for Ruby on Rails Application in cPanel
1. Log into cPanel.
2. Navigate to the Software/Services section of your cPanel interface.
3. Click the Ruby on Rails icon. This step will open the Ruby on Rails management interface.
4. Click the Create Rewrite button corresponding to the appropriate application in the Create A Rewrite table.
Catch-all/default address behavior for new accounts in Cpanel.
The catch-all or default address handles email sent to nonexistent users on your server’s domains. It is useful to keep in mind that spammers frequently use Directory Harvest Attacks to try to guess recipient usernames at known domains. Thus, a domain may receive a large number of spam messages sent to nonexistent users, costing you server resources.
fail — Checks for the intended email recipient and, if no matching recipient is found, denies the SMTP request before downloading the message. This option is recommended.
blackhole — Discards the message after downloading it. This option uses system resources.
localuser — Allows users to set up their own catch-all email addresses. These email accounts will mainly serve to collect spam.
Reference : http://cpanel.net