>

File Diff Nightmare

File Diff Nightmare
Egad, I found myself trying to find the differences between two files, each with over 93,000 lines in them. There were about 100 differences between them. While vimdiff is nifty for smaller files, I just found such large files overwhelming. Meld to the rescue! While I couldn’t get it working on my MacBook Pro, it was a simple as: “sudo yum install meld” on one of my Linux desktops. A quick scp to grab both files from the server and all was good. Meld has many other features such as version control integration and visual merges but, for now, the diff saved the...
read more

BASH: Multiplatform Scripting – Where’s that command?

BASH: Multiplatform Scripting – Where’s that command?
Today’s dilema? I Revived an old script and pushed it out to a dozen or so different machines. Not really a big deal, except the script relies on the ‘uname’ command. Sadly, like many other commands, ‘uname’ isn’t always in the same place and I hate to rely on $PATH in scripts. Fortunately the solution is simple. I happen to know that it is likely in one of two places (though I check four). With this in mind a simple set of tests can get things running smoothly. #!/bin/bash if [ -x "/usr/local/bin/uname" ]; then uname="/usr/local/bin/uname"...
read more

CentOS: Need to change your timezone?

CentOS: Need to change your timezone?
Problems with your system time? So, you just got your new remote server setup, but something seems off? Oh, it’s the time. The times listed in your log files seem wrong, or maybe the modification time on your files. Perhaps your server is using the wrong time zone for your tastes. You can check by running the “date” command. $ date Wed Dec 5 05:59:11 UTC 2012 UTC? That’s not what I want! There’s a good chance the /etc/localtime is linked to the wrong timezone, or worse maybe it’s not linked at all. Maybe it’s a copy of the wrong time zone file? Well the fix is...
read more

Perl: Iterating Through Log Files in a Directory

Perl: Iterating Through Log Files in a Directory
Today I share a Perl snippet to iterate through log files in a specified directory. In this particular case there was a need to parse the log files, ignoring previously compressed files. The file names were in the format of: file.log file.log.1 file.log.2 file.log.3.gz file.log.4.gz … file.log.10.gz Though the file names could go up to *.99, we didn’t know which, if any, would be compressed. Obviously using “*.log” wouldn’t get the *.1 or *.2 files and using “*.log*” picked up the compressed files. The solution was to use “glob” with a couple...
read more

Securing SSH

Securing SSH
Sometimes you have servers hanging out in the public internet in ways that you have little control over the network and hardware firewalls. Setting up a hosted server, such as a Virtual Private Server (VPS) or “node” in the cloud can be scary. Fortunately software firewalls, such as iptables, can add a little to piece of mind. But, in these days of automated attacks, it is still not enough. Usually the primary means of access to these servers is SSH. There are a couple really simple things can be done to make SSH more secure. I recently setup a new node on Linode. In the first hour there...
read more

Fun with iptables

Fun with iptables
I recently setup a CentOS 6.3 server on Linode.com. One of the first things I wanted to do was lock it down with iptables. Unfortunately iptables was not starting cleanly. Specifically, It was failing here: Iptables Error – Setting Chains To Policy ACCEPT: Security Raw Nat Mangle Filter [FAILED] It turns out that was happening due to the paravirt kernel having a “security” chain compiled into it, and the default “iptables” init script included with CentOS does not know how to handle it. After a bit of searching I found a patch for the init script, posted by one of the...
read more

« Previous Entries Next Entries »