Eddie On Everything

Tips & tricks on things that interest me

Entries Tagged ‘perl’

Managing Server Load when unzipping many large files

So, I have about 500 zipped up files that I needed to unzip.  Each of these files is about 100M when decompressed.  I ran into a big problem when unzipping the files all at once – when I did a simple “unzip \*zip", the server load eventually skyrocketed.  The load got so high, in fact, [...]

How To Use Global Variables From Another File In A Perl Module or Package

I’ve been doing a lot of Perl development for my latest project, and I wanted to use a single config file for many scripts. Using a single config file in a basic Perl script is pretty straightforward – you simply use a require statement to read the external file, and the variables contained within are [...]

Rotating Backup Directories using cp -al (hardlinks) to Save Disk Space

The copy command “cp -al” found on all versions of Unix/Linux creates what’s called a “hard link” to a file. The nice thing about this command is that it doesn’t create an actual copy of the file on disk – instead, it creates a “link” or pointer to the file data on the disk. Basically [...]

Using rsync & ssh to Backup Files Between Linux Machines (Perl)

This script performs a network backup using unix’s rsync command over ssh. It performs an incremental backup, which means that it only updates new files and files that have changed since the last backup, thus minimizing network traffic. This script runs on the source machine (SOURCE) and connects to the backup machine (BACKUP). (SOURCE->BACKUP). It [...]

“Argument list too long” from rm command. A Perl Script to Get Around the Problem

You’ve seen the problem – many Unix commands don’t like very long argument lists.  For instance, my Linux machine complains when I try to “rm” 10,000 files at once: [eddie@yoakam test]$ rm * -bash: /bin/rm: Argument list too long Here’s a simple script that will delete all of the files in a given directory, even [...]

How to Easily Install a Perl Module In Ubuntu Linux

Wow, I think I just found the best tip EVER. I had to install a perl module (WWW::Mechanize) and was stuck in a serious dispute with CPAN over dependencies.  Wow, what a mess. Fortunately I found this post by David Yin about how to use Debian’s totally awesome apt-get command to install the module. Steps: [...]

  

Tips graciously accepted