Archives For Bash

One of the more commonly overlooked items when creating shell scripts is their ability to do more than just output to the command line. The misconception that a well written script cannot create or display more advanced GUI controls (progress bars, warning boxes, status updates, etc) will be addressed in some detail. We are going to look at several ways that you can use your shell scripts in a more user friendly manner.

Continue Reading…

If you use bash for scripting you will undoubtedly have to use conditions a lot, for example for an if … then construct or a while loop. The syntax of these conditions can seem a bit daunting to learn and use. This tutorial aims to help the reader understanding conditions in bash, and provides a comprehensive list of the possibilities. A small amount of general shell knowledge is assumed.

Difficulty: Basic – Medium Continue Reading…

Adding EC2 instances to Route53

pinehead —  October 27, 2012

Today’s nifty bit of code is a startup/shutdown script for linux that allows you to add an EC2 instance to Amazon’s Route53 DNS automatically when you start up the instance, and remove it when the instance is knocked down. This script also allows you to add the instance to a weighted round-robin group.

This makes use of the very useful Python-based boto tool which is available in both Yum and Debian repositories under the package name python-boto.

Create this script in /etc/init.d and make it executable, and then add it to the requisite rcX.d directory for startup/shutdown.

Read More