Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Thursday, March 5, 2015

Mathematical Aspect of Linux Shell Programming – Part IV

March 05, 2015
Mathematical Aspect of Linux Shell Programming – Part IV


Hello Everyone,

In this tutorial,

Let Us Create a Mathematical Aspect of Linux Shell Programming – Part IV

You Can also Configure in Redhat Linux, Ubuntu, Fedora, CentOS, LinuxMint, Oracle Linux, Cloud Linux.

Script 1: Additions
Script 2: Substraction
Script 3: Multiplication
Script 5: Table
Script 4: Division
Script 5: Table
Script 6: EvenOdd
Script 7: Factorial


Script 1: Additions

Step1 :-  touch Addition.sh                    --       (Create a file)

Step2 :-  vi Addition.sh                          --      (Editing a file & Save, Quit)

                      #!/bin/bash

                      echo “Enter the First Number: ”

                      read a

                      echo “Enter the Second Number: ”

                      read b

                      x=$(expr "$a" + "$b")

                      echo $a + $b = $x

Step3 :-  chmod 755 Addition.sh           --       (Permission giving)

Step4 :-  ./Addition.sh                            --       (Finally Run Script)

Script 2: Subtraction

Step1 :-  touch Substraction.sh                    --       (Create a file)

Step2 :-  vi  Substraction.sh                         --      (Editing a file & Save, Quit)

                      #!/bin/bash

echo “Enter the First Number: ”

read a

echo “Enter the Second Number: ”

read b

x=$(($a - $b))

echo $a - $b = $x

Step3 :-  chmod 755 Substraction.sh            --       (Permission giving)

Step4 :-  ./ Substraction.sh                            --       (Finally Run Script)

Script 3: Multiplication

Step1 :-  touch Multiplication.sh                    --       (Create a file)

Step2 :-  vi Multiplication.sh                          --      (Editing a file & Save, Quit)

 #!/bin/bash

echo “Enter the First Number: ”

read a

echo “Enter the Second Number: ”

read b

echo "$a * $b = $(expr $a \* $b)"

Step3 :-  chmod 755 Multiplication.sh           --       (Permission giving)

Step4 :-  ./ Multiplication.sh                           --       (Finally Run Script)


Script 4: Division

Step1 :-  touch Division.sh                    --       (Create a file)

Step2 :-  vi Division.sh                         --      (Editing a file & Save, Quit)

                      #!/bin/bash

                      echo “Enter the First Number: ”

                      read a

                      echo “Enter the Second Number: ”

                      read b

                      echo “$a / $b = $(expr  $a  /  $b)”

Step3 :-  chmod 755 Division.sh         --       (Permission giving)

Step4 :-  ./Division.sh                            --       (Finally Run Script)

Script 5: Table

Step1 :-  touch Table.sh                    --       (Create a file)

Step2 :-  vi Table.sh                          --      (Editing a file & Save, Quit)

                      #!/bin/bash

echo “Enter The Number upto which you want to Print Table: ”

read n

i=1

while [ $i -ne 10 ]

do

i=$(expr $i + 1)

table=$(expr $i \* $n)

echo $table

done

Step3 :-  chmod 755 Table.sh           --       (Permission giving)

Step4 :-  ./Table.sh                            --       (Finally Run Script)

 

   Script 6: EvenOdd

Step1 :-  touch EvenOdd.sh                    --       (Create a file)

Step2 :-  vi EvenOdd.sh                          --      (Editing a file & Save, Quit)

                  #!/bin/bash

echo "Enter The Number"

read n

num=$(expr $n % 2)

if [ $num -eq 0 ]

then

echo "is a Even Number"

else

echo "is a Odd Number"

fi

Step3 :-  chmod 755 EvenOdd.sh          --       (Permission giving)

Step4 :-  ./EvenOdd.sh                           --       (Finally Run Script)

Script 7: Factorial

Step1 :-  touch Factorial.sh                    --       (Create a file)

Step2 :-  vi Factorial.sh                          --       (Editing a file & Save, Quit)

                    #!/bin/bash

echo "Enter The Number"

read a

fact=1

while [ $a -ne 0 ]

do

fact=$(expr $fact \* $a)

a=$(expr $a - 1)

done

echo $fact

Step3 :-  chmod 755 Factorial.sh           --       (Permission giving)

Step4 :-  ./Factorial.sh                            --       (Finally Run Script)

NOTE :- For Any Clarification Please Below
 
Comment,
Like and
Share  us  and  help us to spread.

####--------------------------------------------------------------------------------------####
Website    :-   http://www.cloudnetwork.in
Twitter     :-   http://twitter.com/itcloudnet
Skype Id  :-   cloud.network1
E-Mail Id :-   itcloudnet@gmail.com
####----------------------------------------------------------------------------------------####                         
Thanking You
Hope U Like it........


Comment Policy We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually by our human reviewers according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden. Let’s enjoy a personal and evocative conversation.

Shell Scripts for Linux Newbies to Learn Shell Programming – Part II

March 05, 2015
Shell Scripts for Linux Newbies to Learn Shell Programming – Part II


Hello Everyone,

In this tutorial,

Let Us Shell Scripts for Linux to Learn Shell Programming – Part II

You Can also Configure in Redhat Linux, Ubuntu, Fedora, CentOS, LinuxMint, Oracle Linux, Cloud Linux.

Script 1: Drawing a Special Pattern
#!/bin/bash
MAX_NO=0
echo -n "Enter Number between (5 to 9) : "
read MAX_NO
if ! [ $MAX_NO -ge 5 -a $MAX_NO -le 9 ] ; then
               echo "WTF... I ask to enter number between 5 and 9, Try Again“
               exit 1
fi
clear
for (( i=1; i<=MAX_NO; i++ )) do         for (( s=MAX_NO; s>=i; s-- ))
          do
             echo -n " "
          done
          for (( j=1; j<=i; j++ )) do echo -n " ." done echo "" done ###### Second stage ###################### for (( i=MAX_NO; i>=1; i-- ))
do
         for (( s=i; s<=MAX_NO; s++ ))
         do
               echo -n " "
         done
         for (( j=1; j<=i; j++ ))
         do
            echo -n " ."
         done
         echo ""
done
echo -e "\n\n\t\t\t Whenever you need help, cloudnetwork.in is always there"



Script 2: Creating Colorful Script

#!/bin/bash

clear

echo -e "33[1m Hello World"

# bold effect

echo -e "33[5m Blink"

# blink effect

echo -e "33[0m Hello World"

# back to normal

echo -e "33[31m Hello World“

 # Red color

echo -e "33[32m Hello World"

# Green color

echo -e "33[33m Hello World"

# See remaining on screen

echo -e "33[34m Hello World"

echo -e "33[35m Hello World"

echo -e "33[36m Hello World"

echo -e -n "33[0m"

# back to normal

echo -e "33[41m Hello World"

echo -e "33[42m Hello World"

echo -e "33[43m Hello World"

echo -e "33[44m Hello World"

echo -e "33[45m Hello World"

echo -e "33[46m Hello World"

echo -e "33[0m Hello World"


Script 3: Encrypt a File/Directory

yum install pinentry-gui

apt-get install pinentry-gui

Touch Encrypt.sh

Vi Encrypt.sh

#!/bin/bash

echo "Welcome, I am ready to encrypt a file/folder for you"

echo "currently I have a limitation, Place me to thh same folder, where a file to be encrypted is present“

echo "Enter the Exact File Name with extension"

read file;

gpg -c $file

echo "I have encrypted the file successfully..."

echo "Now I will be removing the original file"

rm -rf $file

 Script 4: Checking Server Utilization

#!/bin/bash

    date;

    echo "uptime:"

    uptime

    echo "Currently connected:"

    w

    echo "--------------------"

    echo "Last logins:"

    last -a |head -3

    echo "--------------------"

    echo "Disk and memory usage:"

    df -h | xargs | awk '{print "Free/total disk: " $11 " / " $9}'

    free -m | xargs | awk '{print "Free/total memory: " $17 " / " $8 " MB"}'

    echo "--------------------"

    start_log=`head -1 /var/log/messages |cut -c 1-12`

    oom=`grep -ci kill /var/log/messages`

    echo -n "OOM errors since $start_log :" $oom

    echo ""

    echo "--------------------"

echo "Utilization and most expensive processes:"

    top -b |head -3

    echo

  top -b |head -10 |tail -4

    echo "--------------------"

    echo "Open TCP ports:"

    nmap -p- -T4 127.0.0.1

    echo "--------------------"

    echo "Current connections:"

    ss -s

    echo "--------------------"

    echo "processes:"

    ps auxf --width=200

    echo "--------------------"

    echo "vmstat:"

    vmstat 1 5

  
1.   ‘>‘ : the redirection operator causes a file creation, and if it does exist, the contents are overwritten.

2.   ‘>>‘ : when you use >>, you are adding information, rather than replacing it.

3.   ‘>>‘ is safe, as compared to ‘>‘

Script 5: Check Disk Space and Sends an Email Alert

MAX=95

EMAIL=USER@domain.com

PART=sda1

USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1`

 if [ $USE -gt $MAX ]; then

echo "Percent used: $USE" | mail -s "Running out of disk space" $EMAIL

fi

 
Comment,
Like and
Share  us  and  help us to spread.

####--------------------------------------------------------------------------------------####
Website    :-   http://www.cloudnetwork.in
Twitter     :-   http://twitter.com/itcloudnet
Skype Id  :-   cloud.network1
E-Mail Id :-   itcloudnet@gmail.com
####----------------------------------------------------------------------------------------####                         
Thanking You
Hope U Like it........


Comment Policy We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually by our human reviewers according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden. Let’s enjoy a personal and evocative conversation.

Monday, March 2, 2015

Complete Installation Guide for Android Emulator SDK/ADT Manager With Eclipse on Ubuntu 14.10,15.04

March 02, 2015
Complete Installation Guide for Android Emulator SDK/ADT Manager With Eclipse on Ubuntu 14.10,15.04



Hello Everyone,

In this tutorial

Let Us Install Android Emulator SDK Manager with Eclipse on Ubuntu 14.04, 14.10 or 15.04 - 64bit

        You Can also Install in Debian 7.5, Linux Mint 17, Xubuntu & Lubuntu

Requirement
Internet speed should be good 64 bit only support

Empty space should be 5gb above for both installation and configuration

Installing Linux Distribution
Step1 :- sudo apt-get install ia32-libs
Step2 :- sudo apt-get install libgl1-mesa-dev


Watch the Video on Youtube.com/itcloudnet

For java installation

sudo apt-get Install openjdk-7-jdk
                     Or
sudo apt-get install openjre-7-jre


Step3 :- sudo gedit ~/.pam_environment  or ~/.bashrc
PATH DEFAULT=${PATH}:/path/to/tools`
PATH DEFAULT=${PATH}:/path/to/platform-tools


Downloading Android SDK Manager
Step3 :-  wget http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
Step4 :-  tar -zxvf android-sdk_r24.0.2-linux.tgz
Step5 :-  ./android



NOTE :- For Any Clarification Please Below
 
Comment,
Like and
Share  us  and  help us to spread.

####--------------------------------------------------------------------------------------####
Website    :-   http://www.cloudnetwork.in
Twitter     :-   http://twitter.com/itcloudnet
Skype Id  :-   cloud.network1
E-Mail Id :-   itcloudnet@gmail.com
####----------------------------------------------------------------------------------------####                         
Thanking You
Hope U Like it........

Saturday, February 28, 2015

Unable to start systemd service in Docker container in Fedora Desktop or Server

February 28, 2015
 Unable to start systemd service in Docker container in Fedora Desktop or Server
The step 'systemctl start redis.service' failed with this error message:

Failed to get D-Bus connection: No connection to service manager. 
 


To Solve the Error's Just Type in Safe Mode

/usr/lib/systemd/systemd --system &

Wednesday, February 25, 2015

How to Install OwnCloud 8 to Create Personal Cloud Storage in Ubuntu

February 25, 2015
How to Install OwnCloud 8 to Create Personal Cloud Storage in Ubuntu

Hello Everyone,

In this tutorial,

Let Us Install OwnCloud 8 Released – Create Personal/Private Cloud Storage in Ubuntu 14.04, 14.10 LTS -

You Can also Install in Linux Mint17, Debian, Xbuntu

In order to setup your own personal cloud storage (ownCloud), you must have LAMP (Linux, Apache, MySQL, PHP) stack installed. Other than LAMP stack you might need Perl and Python based upon your use.

Step 1 :- sudo apt-get install apache2 apache2-doc apache2-utils mysql-server mysql-client php5 php5-mysql php5-curl.

Create Cloud Database
Once you setup LAMP stack on your personal box, just login to your database (MySQL, here).

Step 2 :- mysql -u root –p

Step 3 :- create database cloud ;

Step 4 :-  grant all on cloud.* to cloud@localhost identified by 'my_password';

Download and Install ownCloud Application



Step 5:- cp owncloud-8.0.0.tar.bz2 /var/www/

Step 6:- tar -jxvf owncloud-8.0.0.tar.bz2

Step 7:- rm -rf owncloud-8.0.0.tar.bz2

Step 8:- chmod -R 777 owncloud/

Configuring Apache for ownCloud

For security purpose ownCloud uses Apache‘s .htaccess files, in order to use them. We need to enable two Apache modules mod_rewrite and mod_headers for ownCloud to function properly.

Step 9:-   a2enmod rewrite
                a2enmod headers

Step 10:- nano /etc/apache2/apache2.conf
There, find “AllowOverride None”  under  Directory /var/www/ and change this to “AllowOverride All”

Step 11:- AllowOverride   All

Step 12:- service apache2 restart
Access ownCloud Application



OR


Error’s
404 Not Found
the requested URL /owncloud/ was not found on this server.
apache/2.4.7 (Ubuntu) Server at myIP Port 80

Edit    /etc/apache2/sites-available/000-default.conf
DocumentRoot  /var/www/html
to
DocumentRoot  /var/www/

Restarted apache

Error’s

sudo apt-get install php5-gd

/etc/init.d/apache2 restart

Error’s

First edit the file apache2

sudo gedit  /etc/apache2/apache2.conf
then find Directory /var/www/ change
AllowOverride none
to
AllowOverride  All

Save & Quit

Restarted apache
sudo service apache2 restart

NOTE :- For Any Clarification Please Below
 
Comment,
Like and
Share  us  and  help us to spread.

####--------------------------------------------------------------------------------------####
Website    :-   http://www.cloudnetwork.in
Twitter     :-   http://twitter.com/itcloudnet
Skype Id  :-   cloud.network1
E-Mail Id :-   itcloudnet@gmail.com
####----------------------------------------------------------------------------------------####                         
Thanking You
Hope U Like it........