Saturday, March 3, 2018

Learn Shell Scripting In One Day

Let’s learn “Shell Scripting In a day”. So, in this post I wanted to talk about “What is a shell script?" & "learner guide to shell scripting with examples". Before jumping into learning on how to code and execute shell scripts, let’s talk a bit about “Linux” and history of Linux evaluation.

Linux is technically the kernel, so, there are other utilities such as GNU tools, GCC compiler etc,. which would ideally make a complete operating system (OS). That is the reason it is called GNU (GNUs not Unix) Linux not simply Linux. If I just say Linux then I’m talking about only the kernel.  GNU Linux is one of the widely used OS in market, because it is open-source, so anyone could download/re-use the kernel, publish a new Linux distribution under the guidelines of GPL & Free Software Foundation.

Learn Shell Scripting -- Part 2

Conditional operations using “if…else…fi” statement

We could use “if” statement when it is required to perform a conditional based operation. So, if the condition is true then process a set of commands, otherwise, process some other commands/action. The syntax of this is:

if [ <conditional statement> ]
< statements >    <--------- these statements gets executed if condition is true.
 < statements >   <--------- these statements gets executed if condition fails.

Learn Shell Scripting -- Part 3

Let’s look into some of the commonly used built-in standard shell variables.

In this section we are going to see some of the standard shell built-in variables which we generally use in shell scripting.

#echo $? ---------- this would show the exit status of the previous command run in shell (0 - success, anything other than 0 is considered as failure)
#echo $$ ---------- this shows current shell ID (when run inside a script this would print the PID assigned to
the shell).
#echo $@ OR #echo $* ---------- this prints the arguments passed when called for execution.
#echo $# ---------- this would show up total number of arguments passed.
#echo $! ---------- this would report PID of previous background process.

Friday, February 2, 2018

A few advanced differences between RHEL7.x & RHEL6.x

Extracting initramfs image :--

Using "skipcpio" command in RHEL7.x, otherwise, we use "gunzip" in earlier RHEL versions. So, the command to extract initramfs image file in RHEL7.x is " /usr/lib/dracut/skipcpio /boot/initramfs-$(uname -r).img | gunzip -c | cpio -id ". In earlier versions, we could do this by using the command gunzip "gunzip -c /boot/initramfs-$(uname -r).img | cpio -i -d ".

Thursday, January 4, 2018

Introduction To Ansible ............. Simple, Easy & it is YAML

Now-e-days we get to hear a lot about automation, specifically Infrastructure Automation. Technology has already shifted gears towards automation way of controlling IT Infrastructure. This is much needed for today's fast/rapid changing technology or infrastructure, as demands from customer end does also took a sharp turn from way of investing/setting up infrastructure towards hosted infrastructure which we call it as "Cloud". A commonly used term which basically allows/facilitates converting physical infrastructure into a framework which is easy to scale-up & flexible that provides a virtual platform where everything is defined as service i.e majorly as IaaS (Infrastructure As A Service), PaaS (Platform As A Service) & SaaS (Software As A Service). There is a similar wing where activities of operation and development could be closely associated which we commonly call it as "DevOps".  Yes, I'm talking about one such tool that is being used to automate tasks in infrastructure which is "Ansible". A simple, easy to use, easy to automate tasks i.e to write playbooks and easy to is YAML (Ain't Markup Language, the language used to write playbooks). In this blog page, I wanted to talk about a few introductory points about Ansible and a little about installing and setting up.