Wednesday 20 April 2016

Script to check if a server / machine is up and running

Guys you might often come across some situations where you want to check if a server or machine is physically up and running. Quite obviously you would use the ping command to do so.

But in today's post let us write a simple bash script to automate this.

#!/bin/bash
#program to check if a server/machine is up and running

ipaddr=192.168.1.34

ping -c 4 $ipaddr >> /dev/null

if [[ $? -ne 0 ]]
then
echo "FAIL: Server seems to be down and not responding" 

else
echo "SUCCESS : Server is up and running"


fi

Note : $? is a special Unix variable to check if the previous command was executed successfully or not. It returns a numerical value - either 0 or 1. If the command was executed successfully, it returns 0, else if not, it returns 1.

In above script, simply replace the variable 'ipaddr' value to your server's ip address and check.

Also note that by redirecting the output of the ping command to /dev/null, we are suppressing and silencing the output i.e the ping o/p will not be shown on terminal. If you want to see the exact output of ping, remove the ">> /dev/null" part.

Output :

./PingServer.sh
SUCCESS : Server is up and running

Cheers!

Simple Interest Calculation : Shell Script for Mac OS X

Guys, today we'll look into a very basic simple shell script to calculate the Simple Interest. For this we need 3 essential details :

Principal Amount
Rate of Interest
Period i.e No. of years

Here's the bash script to calculate the Simple Interest.

#!/bin/bash
#program to calculate simple interest

echo "================================"
echo "Simple Interest Calculation Tool"
echo "================================"
echo "Enter principal amount : "
read principal
echo "Enter Rate of Interest : "
read roi;
echo "Enter No. of years : "
read years;

simple_interest=`expr "($principal*$years*$roi)/100"|bc`
echo "Simple Interest = $simple_interest"

Output :

./SimpleInterest.sh
================================
Simple Interest Calculation Tool
================================
Enter principal amount : 
5000
Enter Rate of Interest : 
9.5
Enter No. of years : 
5

Simple Interest = 2375

If you note, we have used the bc command to evaluate our expression i.e the Simple Interest formula. More on bc can be read here.

How to identify available shells on Mac OS X

Guys you may be aware that you can find your current shell in Mac OSX or any Unix machine by typing the following in Terminal.

echo $SHELL
/bin/bash

But to identify the available shells on Mac OS X type the following :

cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

Also, if you ant to change your default shell, type this :

chsh
Changing shell for ironcladzone.

Password for ironcladzone: 

Hope it helps. Cheers!

Saturday 9 April 2016

GRE GMAT CAT Wordlist - TurboPack 8

Hi there! Hows it going today? Hope the previous TurboPacks are helping you in a small and efficient way in your preparations. Well let me know your valuable suggestions and comments to improve the quality and/or overall experience.


For now, let's continue with the latest TurboPack 8 for the day.

supple : flexible, bending and moving easily, limber
mogul : powerful person
lofty : very high
wholesome : healthful
indigence : extreme poverty
aspersion : slanderous remark, attack on someone's reputation
archetype : prototype, a typical example
gorge : narrow canyon, narrow valley, throat
putrid : foul smelling, decaying or rotten smell
simulate : imitate, pretend

Folks, more TurboPacks are on the way. Make sure to check for my previous TurboPacks 1-7 for reference. Again let me repeat that try to work on small batches of words at a time and focus on them thoroughly. Hope it helps. Ciao!

Thursday 7 April 2016

GRE GMAT CAT Wordlist - TurboPack 7

Hi guys! hows it going? Hows your verbals preparation coming along. Hope the previous TurboPacks are useful in some way. Kindly do post your valuable comments and suggestions guys.



Here's another small batch of 10 Turbo words for the day.

encircle : surround
armada : fleet of warships
garish : overbright in color, gaudy, showy
exhume : dig out from ground
ferret : hunt out of hiding, assiduous search for something
arid : dry, barren
jetsam : things thrown from a ship usually to lighten it
oust : expel, drive out
paragon : model of perfection, a perfect example, of perfect quality
exquisite : very finely made, very beautiful and delicate

And incase you missed it, here are the links to previous TurboPacks

TurboPack 1
TurboPack 2
TurboPack 3
Turbopack 4
TurboPack 5
TurboPack 6

Wednesday 6 April 2016

GRE GMAT CAT Wordlist - TurboPack 6

Ola fellas! como estas? How you guys doing? Hope the TurboPacks are aiding your preparations. Let me know your valuable comments and suggestions and if any more assistance needed.


So the TurboPack 6 is as follows :

rebuke : scold harshly, sharply criticise
mischance : ill luck, bad luck
ineffectual : weak, not effective
shirk : avoid/neglect work or responsibility
petty : trivial, unimportant
respite : relief, time for rest
parable : short story with a moral or lesson
shrewd : clever, astute
mirage : unreal reflection, optical illusion
astral : relating to the stars

The TurboPack 7 will be posted tomorrow. Stay tuned folks.

Tuesday 5 April 2016

GRE GMAT CAT Wordlist - TurboPack 5

Thanks guys for the good response for my previous TurboPacks. Well, as I said before more TurboPacks are in the pipeline and would be posted at regular intervals. Am really encouraged to post more Packs like these. Again let me reiterate that the USP of TurboPacks is the random non-alphabetical sequencing of words. I think it helps in improved memorisation. Hope it helps guys.

In the meantime, I suggest you cut a cardboard or simply a blank page into 10 mid-sized rectangles. Create your own 10 flash cards the moment you come across the new words in TurboPack. On one side of the rectangle write the word and on the other side write the meaning/synonym. Perhaps a rectangle of the size of the logo below. What say? You could refer to them throughout the day, whenever you wish to. Just target this small batch of 10 words and focus on them thoroughly.


Ok so here we go again. Here's the TurboPack for today.

mortician : an undertaker, a funeral director
biennial : every two years
pyromaniac : person with an obsessive desire to set things on fire
canard : baseless unfounded rumor or story
onslaught : fierce attack, a vicious assault
philanderer : womaniser, a flirt, faithless lover
churlish : rude or boorish
rebate : discount, partial refund
doze : nap, short light sleep
residual : leftover, remaining
Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker