Archive for the “Code Snippets” Category

Code snippets including custom code releases and modified GPL code to resolve issues or provide functionality.

Recently I was working on a project that was using RightScale to manage RackSpace cloud nodes. One of the requirements of the project was to have application nodes scale automatically thus they were required to automatically install software, configure settings, and start services automatically on the RackSpace CentOS nodes being used. Most everything was fairly straight forward however some of the services we were using would not start properly and initially because of the lack of logging from the services we were unable to figure out what the problem was. Below I describe the problem in more detail along with the solution which involved updating a configuration file on the CentOS Linux servers and then restarting the services.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , , , , ,

Comments No Comments »

Recently while working on some node or instance automation using RightScale I needed to have some extra iptables rules created automatically when a new node booted. Initially I was just trying to do this via iptables commands which I note below but it would never work. After digging through the logs I realized that the iptables commands created by RightScale for the ServerTemplate I was using flushed iptables at the very end of the boot process and thus wiped out the iptables entries created by the RightScript I had created. To accomplish permanent iptables entries for a RackSpace node via RightScale you need to output the iptables command to a file in the location where the boot process picks them up after flushing the current ruleset. Below I describe my first attempt followed by the correct way to have iptables entries picked up by RightScale.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , , , ,

Comments No Comments »

The other day I needed to create a RightScript shell script that would update a couple configuration files on a server that was being launched in the RackSpace Cloud via RightScale. I decided to use SED to find and replace content within the configuration files. The first pass at the script failed because what I thought were spaces ended up being tabs. Use the information below to represent a tab within a shell script when using sed.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , , ,

Comments No Comments »

I spent a lot of time the other night trying to find a perl script that would decode Cisco type 7 password hashes and many of them did not work properly. At first I thought I was doing something wrong however I am pretty sure that most of the scripts were just broken. Anyhow I finally located the below script on some site and I can’t remember where I found it so I wanted to post it here mostly for reference however if someone else finds it useful then that would be great. Below is the actual script itself followed by an example of using the script.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , ,

Comments 4 Comments »

Earlier tonight I created a little script that will run in cron on a Linux server. The script counts the number of directories and files in a specific directory and if the count is above Y then it deletes directories and files older than X number of days. In the example script below the number of items (directories and files) that have to be located in the directory before the script to delete files older than a specific date is 10. If there are ten items then the script will delete items older than 90 days. Below the script is the entry made in a specific users cron on the Linux server.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , , ,

Comments No Comments »