linux

8 examples of Bash if statements to get you started

Shell scripting is a fundamental skill that every systems administrator should know. The ability to script mundane & repeatable tasks allows a sysadmin to perform these tasks quickly. These scripts can be used for anything from installing software, configuring software or quickly resolving a known issue. A fundamental core of any programming language is the if statement. In this article I am going to show several examples of using if statements and explain how they work.

Using rsync to synchronize a local and remote directory

Recently I had moved my blog from WordPress to a custom python script that generates static HTML pages. After generating files I need to copy them to my web servers. While it is easy enough to FTP or SCP the files from my local machine to the remote web servers. I am looking for a little more elegant and automated solution. For that reason I have chosen to use the rsync command.

Yum Plugins: Verifying packages and configurations with Yum Verify

While taking a Red Hat Training course the instructor showed us a Yum plugin called verify. I've never used any of the Yum plugins before and after a while of playing with Yum Verify, I have decided that I should share this very cool plugin and introduce others to Yum plugins. What are Yum Plugins Yum plugins are packages that can be installed to provide extra functionality to the Yellowdog Update Manager or yum.

Installing Redis and setting up Master - Slave Replication

Over the past few years the usage of NOSQL databases has grown quite a bit. Part of this popularity is due to the scalability and performance seen with NOSQL solutions, one of those highly performant databases is Redis. Redis is an highly popular open source in memory key - value data store that is currently in use at and highly praised by tech companies such as Twitter, Stack Exchange and Github.

Managing DNS locally with /etc/hosts

Before the advent of a distributed domain name system; networked computers used local files to map hostnames to IP addresses. On Unix systems this file was named /etc/hosts or “the hosts file”. In those days, networks were small and managing a file with a handful of hosts was easy. However as the networks grew so did the methods of mapping hostnames and IP addresses. In modern days with the internet totaling at somewhere around 246 million domain names (as of 2012) the hosts file has been replaced with a more scalable distributed DNS service.

Install RackTables and start tracking your IP address inventory

Recently while I was scouring through a spreadsheet of “unallocated” IP addresses, I thought to myself. There has to be a better way to manage an inventory of IP addresses, and while I'm at it maybe even provide a list of provisioned servers. After some googling I found myself on RackTables.org the home of an open source project that aims to provide just what I was looking for. An Inventory system that tracks and manages Servers, Racks, IP Addresses and just about everything else in a data center.

Symlinks vs Hardlinks and how to create them

In a previous article I covered a little bit about Symlinks and Hardlinks but I never really explained what they are or how to create them. Today I am going to cover how to create both Symlinks and Hardlinks and what the difference is between the two. What are Symlinks and Hardlinks Hard Links In Linux when you perform an listing in a directory the listing is actually is a list of references that map to an inode.

Setting process CPU priority with nice and renice

Nice is a command in Unix and Linux operating systems that allows for the adjustment of the “Niceness” value of processes. Adjusting the “niceness” value of processes allows for setting an advised CPU priority that the kernel's scheduler will use to determine which processes get more or less CPU time. In Linux this niceness value can be ignored by the scheduler, however other Unix implementations can treat this differently. Being able to adjust the niceness value comes in handy in two scenarios usually.

Getting started with SaltStack by example: Automatically Installing nginx

Systems Administration is changing, with the huge scale of internet company deployments and the popularity of cloud computing. Server deployments are often scaling faster than the systems administration teams supporting them. In order to meet the demand those teams are finding themselves changing the ways they have traditionally managed servers. One of those changes is automation, where once a sysadmin would need to spend time installing packages by hand (via apt or yum) and modifying configuration files.

Finding the OS version and Distribution in Linux

When supporting systems you have inherited or in environments that have many different OS versions and distributions of Linux. There are times when you simply don't know off hand what OS version or distribution the server you are logged into is. Luckily there is a simple way to figure that out. Ubuntu/Debian $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.04 DISTRIB_CODENAME=raring DISTRIB_DESCRIPTION="Ubuntu 13.04" RedHat/CentOS/Oracle Linux # cat /etc/redhat-release Red Hat Enterprise Linux Server release 5 (Tikanga) Catchall If you are looking for a quick way and don't care what the output looks like, you can simply do this as well.