EZ Linux Admin random header image

Repair DNS scripts and tips

March 19th, 2010 by EZ linux · No Comments

Fixing DNS is a tricky thing, with cpanel there is a couple steps to try first.

DNS failed you are not sure why, try this first:

/scripts/cleandns
/scripts/rebuildnamedconf

Still not working, try this:

/scripts/rebuilddnsconfig
/scripts/fixdns

Basically DNS has about 5 files that need to all be in sync for named DNS to run.

I highly recommend running three servers with DNS so you have back ups if one servers fails. In this case you just transfer over the dns files and restart. Here is a list of the DNS files that need to be transferred.

named.conf.cache

named.conf.zonedir.cache

named.conf

named.conf,v

named.conf_back

named.conf.fixrndc

named.conf.prefixrndc

named.conf.rpmsave

→ No Comments Tags: Cpanel and WHM · Linux Software / Scripts


How to do a search and replace over multiple files

March 18th, 2010 by EZ linux · No Comments

You could also use find and sed, but I find that this little line of perl works nicely.
perl -pi -w -e ‘s/search/replace/g;’ *.php

-e means execute the following line of code.
-i means edit in-place
-w write warnings
-p loop

Example I had the following style sheet in a section:
<link rel=”stylesheet” type=”text/css” href=”../includes/style.css”>

and I wanted the following instead:
<link rel=”stylesheet” type=”text/css” href=”admin.css”>

As each expression is a regular expression you’ve got to escape the special characters such as forward slash and .
\.\.\/includes\/style\.css

So the final line of code ends up as
perl -pi -w -e ‘s/\.\.\/includes\/style\.css/admin\.css/g;’ *.php

→ No Comments Tags: Cheat Sheets · Linux Commands


You don’t need to ‘know’ Linux to use Linux

March 18th, 2010 by EZ linux · 1 Comment

Lately, I’ve been noticing stories about how to use Linux you need to know half-a-hundred Linux shell commands and the like. Ah, what century are you from? Today, if you can see a window and handle a mouse, you’re ready to use Linux.

And no, I’m not talking about how we’re all already using Linux in devices like the TiVo or the Droid smartphone and through Linux-powered Web sites like Google. I’m talking about using Linux on the desktop.

There is nothing — I repeat, nothing — that requires any special knowledge to use Linux on the desktop today. If you’ve already mastered Windows XP, you’ll have little more trouble moving to a Linux desktop like Red Hat’s Fedora 12; Novell’s openSUSE 11.2; or Canonical’s Ubuntu 9.10 than you would in switching over to Windows 7.

I’m not saying using Linux isn’t different from running Windows. It is. For example, you’ll need special software like Crossover Linux to run Windows-specific software.

The interfaces also aren’t the same — but then, Windows 7 and Vista’s interfaces aren’t the same as XP’s, and Mac OS X’s Aqua interface doesn’t look anything like the others. Besides, can any other operating system besides Linux let you set up the interface so that it duplicates XP’s look and feel? I think not!

What you don’t need to use desktop Linux is to learn dozens of obscure Linux shell (aka command line) programs to get work done. Neither do you need to know how to edit configuration files by hand to get Linux set up properly.

Sure, it can help to know how to use the Unix/Linux shell. I was writing shell (awk, sed, and grep) scripts to get work done in Unix, and later Linux, before many of you played your first game of solitaire on Windows 1.0. My point is, for ordinary, everyday use, you don’t need to know anymore about those things than you need to know how to edit Windows’ registry to run Windows.

I use desktop Linux every day, and I’m a Linux expert. Do you know how often I turn to a terminal to get to a shell to run commands? Maybe once a month, if that.

Between the two major Linux desktop interfaces, KDE and GNOME, Linux has you covered. For applications, many of the most popular applications, such as Firefox and OpenOffice, run just the same on Linux as they do on Windows. For other end-user programs, Linux programs such as Evolution for e-mail and Pidgin for IM are just as good, if not better, than their Windows equivalents. And again, you don’t need to know anything special to use them.

Installing new software on Linux isn’t any trouble either. Better still, major Linux distributors like Ubuntu are continuing to make installing Linux software easier than ever with programs like Ubuntu Software Center.

Don’t get me wrong: if you’re running a Linux server, you really need to know Linux’s technical guts. But you know what? If you’re running a Windows server, you also need to know Window’s version of the shell, the PowerShell.

No matter what desktop operating system you’re running, if you really want control over exactly what it does, you need to know how to manage its command line tools. But for day-to-day use, Linux’s graphical interfaces makes it just as easy to use as Windows or Mac OS X. Pretending that you need to be some kind of computer wizard to run Linux on the desktop today is just downright silly.

→ 1 Comment Tags: About Linux · Linux News · Linux Operating Systems


Getting a md5sum error when tranferring a cpanel account?

March 3rd, 2010 by EZ linux · No Comments

This usually means you need to upgrade Perl on the server. Here is a example of a md5sum error.

The remote server didn’t report a correct md5sum of the archive. Please ensure you selected the correct type of remote server.

To fix upgrade Perl as shown here:

http://www.ezlinuxadmin.com/2009/08/upgrading-perl-on-cpanel/

→ No Comments Tags: Cpanel and WHM · Linux Commands · Linux Software / Scripts


My new favorite rsync command

March 3rd, 2010 by EZ linux · No Comments

rsync -vae ssh 12.123.123.123:/home/dwhsbackup/daily/username/ /backup/cpbackup/daily2/username/ –bwlimit=10000 –exclude-from ‘/root/exclude.txt’

→ No Comments Tags: Linux Commands · Linux Software / Scripts · Linux Tricks


Calm down rsync if it overloads your IO memory or CPU

March 3rd, 2010 by EZ linux · No Comments

The trick is to limit I/O bandwidth for rsync.

The –bwlimit option limit I/O bandwidth. You need to set bandwidth using KBytes per second. For example, limit I/O bandwidth to 10000KB/s (9.7MB/s), enter:

rsync –delete –numeric-ids –relative –delete-excluded –bwlimit=10000 /path/to/source /path/to/dest/?

10 megs a second is plenty of speed and will keep the server running smoothly when your grabbing allot of files off of it.

→ No Comments Tags: Cheat Sheets · Linux Commands · Linux Security · Linux Software / Scripts · Linux Tricks


rsync running slow?

March 3rd, 2010 by EZ linux · No Comments

Today I was transferring files through rsync it was taking forever, my guess was the new server or old server was out of memory so I killed some procs and even rebooting the server but still it was crawling. So I thought I would think out of the box and after a couple trial and errors I tried a nic reboot and wow it was super fast from there.

/etc/init.d/network restart

I’m still not sure how the nic got blogged up but this worked like charm.

Keep in mind this is a temp fix, what you need to do is both your nic card going by adding another IP via cpanel and via the setup tool access from the root of the server. Try to separate the IP traffic that best that you can between both nic cards on the server.

→ No Comments Tags: Hardware · Linux Commands · Linux Tricks


All cpanel server should have the /var tmp folder symlinked to /tmp

March 2nd, 2010 by EZ linux · No Comments

Here is how, first remove the /var/tmp folder

rm -rf /var/tmp

Then add the symlink:

ln -s /tmp /var/tmp

→ No Comments Tags: Linux Images


Free /usr partition space by a symlink to domlogs

February 10th, 2010 by EZ linux · No Comments

First move the domlogs folder to the backup partition:

mv /usr/local/apache/domlogs /backup

Then create a symbolic link to it:

ln -s /backup/domlogs /usr/local/apache/domlogs

→ No Comments Tags: Linux Commands · Linux Tricks


Default MYSQL port

February 9th, 2010 by EZ linux · No Comments

The default MYSQL port is:

3306

→ No Comments Tags: Cheat Sheets · Linux Security · Ports