Category Archives: Operating Systems

Operating Systems general commands and issue fixes cover in Linux , Windows, Solaris, Unix , HP-UX etc.

Configure yum manually on Oracle Linux Platform from Media

Configure yum manually on Oracle Linux Platform from Media

I am using Oracle Virtual box in which i installed oracle Linux platform.

Following are steps to configure yum manually through Media or ISO image:

Step 1: Transfer the complete iso image of Linux to you local drive.
Note: I am using linux 7.4 so making naming conventions as 7.4 for all folder below. So change according to your need.

mkdir /ISOs
cp /media/USB_Sticks/Linux7-4.iso /ISOs

Step 2. Create Folder for the mounting the DVD image on it:

mkdir -p /var/OSimage/OL7.4_x86_64

mount -o loop,ro /ISOs/Linux7-4.iso /var/OSimage/OL7.4_x86_64

Yum1

Step 3: On Restart, we need to fire command again in step 2. Avoid it make an entry in /etc/fstab

vi /etc/fstab
-- Insert entry into file /etc/fstab
/ISOs/Linux7-4.iso /var/OSimage/OL7.4_x86_64 iso9660 loop,ro 0 0

Step 4: In /etc/yum.repos.d directory, edit the existing file present public-yum-ol74.repo and disable all entries by setting enabled=0.

vi public-yum-ol74.repo
-- Make all the enabled parameter to value 0

Step 5: Create the new entries in a new repository file

For example, /etc/yum.repos.d/OL74.repo

-- Create new file
vi /etc/yum.repos.d/OL74.repo

-- Insert following entries in file and take care of fist parameter [OL74] as naming of the file name.
[OL74]
name=Oracle Linux 7.4 x86_64
baseurl=file:///var/OSimage/OL7.4_x86_64
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=1
enabled=1

Step 6: Clean up the yum cache from the system.

yum clean all

yum-clean-all

Step 7: Check yum to access the repository.

yum repolist

yum-repolist

Step 8: Verify yum is working properly.

yum list
yum install gcc

Advertisements

CHCP on command prompt for accept different languages

CHCP is setting active code page on the command prompt to display different language or accept different language temporary

Displays or sets the active code page number.

CHCP Specifies a code page number.

Type CHCP without a parameter to display the active code page number.

274 - Brazil
275 - Brazil
442 - Bulgaria
319 - Greece
161 - Iceland
118 - Macedonia, Serbia, and Montenegro
333 - Romania
441 - Russian
437 - United States
850 - Multilingual (Latin I)
852 - Slavic/Eastern European
860 - Portuguese
863 - Canadian-French
865 - Nordic
850 - Multilingual (Latin I)
852 - Slavic/Eastern European
857 - Turkish
861 - Greek
437 - United States
850 - Multilingual (Latin I)
852 - Slavic/Eastern European
855 - Cyrillic I
866 - Russian (Cyrillic II)
861 - Icelandic
866 - Russian
869 - Modern Greek
1252 - West European Latin
65000 - UTF-7 *
65001 - UTF-8 *

Enable JavaScript for Windows Internet Explorer

Enable JavaScript for Windows Internet Explorer

Error: Your browser does not have Javascript enabled. Javascript is required to use this application.

For this you need to enable active script in scripting heading

Error: JavaScript is required. Enable JavaScript to use OAM Server.

For this error you also need to enable java applet in scripting heading.

1. Select Internet Options from the Tools menu.

c1

2. Click the Security tab and go to Custom Level

C2

3. Scroll down to Scripting, near the bottom of the list.Under Active Scripting, choose Enable.

C3

4. Enable the java applet as follows:

C5

5. Click OK to leave Security Settings. Click OK to leave Internet Options.

C4

6. You will need to close and restart your browser for the settings to take effect.

Script for List the Drives with Size in Windows as Batch script

Script for list all the drives with size information in windows platform

Use steps as follows:

1. Save the below script as batch file with any name like diskinfo.bat

2. Go to the location of script placed:
 Cd D:\scripts

3. Open the command prompt windows and execute it with following command:
D:\scripts> diskinfo.bat localhost
 
4.  Output as follows:

Drive: C:
=========================
Total space: 266 GB
Free space : 221 GBDrive: D:
=========================
Total space: 482 GB
Free space : 482 GB

Script as follows:

@ECHO OFF
IF "%~1"=="" goto help
@SETLOCAL ENABLEEXTENSIONS
@SETLOCAL ENABLEDELAYEDEXPANSION

@FOR /F "skip=1 tokens=1" %%x IN ('"WMIC /node:"%1" LOGICALDISK GET Name " ') DO (
REM @ECHO %%x

@FOR /F "tokens=1-3" %%n IN ('"WMIC /node:"%1" LOGICALDISK GET Name,Size,FreeSpace | find /i "%%x""') DO ( @SET FreeBytes=%%n & @SET TotalBytes=%%p

SET TotalSpace=!TotalBytes:~0,-9!
SET FreeSpace=!FreeBytes:~0,-10!

SET /A TotalUsed=!TotalSpace! - !FreeSpace!

REM IF !TotalSpace! LSS 0 goto error

@echo.
@echo.
@echo Drive: %%x
@ECHO ===========================
@ECHO Total space: !TotalSpace! GB
@ECHO Free space : !FreeSpace! GB

REM @SET TotalSpace=
REM @SET FreeSpace=
REM @SET TotalUsed=
REM goto end
)
)
goto end
:error
echo.
echo *** Invalid server or drive specified ***
echo.
goto help

:help
echo.
echo diskfree.cmd
echo.
echo Queries remote server for free disk space.
echo Specify a MACHINENAME and a drive letter to be queried
echo.
echo Example:   diskfree.cmd MACHINENAME c:
echo.
goto end

:end

 

Crontab commands

Crontab Commands

Crontab is the utility used for scheduled any script and job in the Operating System Level. It comes with the Linux, HP-UX , Unix and Other Operating System.

It is very usefully utility for scheduling purpose.

To list or display all the scheduled job in crontab:

crontab -l

To add entry or change in existing job in crontab:

crontab -e

Backup of Crontab:

crontab -l > crontab_new

it will make a copy of crontab into crontab_new file.

Restore of Crontab:

crontab crontab_new

It will set crontab_new as crontab

Crontab have 5 parameters as:

minutes(0-59) Hours(0-23) day_of_month(1-31) month(1-12) day_of_week(0-6) (sunday=0)

example:

———–
0  5   *  *  * sh backup.sh

*    *     *     *     *  command to be executed
–    –     –     –     –
|    |     |     |     |
|    |     |     |     +—– day of week (0 – 6) (Sunday=0)
|    |     |     +——- month (1 – 12)
|    |     +——— day of month (1 – 31)
|     +———– hour (0 – 23)
+————- min (0 – 59)

Example for scheduling
*       *           *     *     *          #Runs every minute
30    *           *      *    *          #Runs at 30 minutes past the hour
15    8          *      *    *          #Runs at 8:15 am every day
15    20        *      *    *          #Runs at 8:15 pm every day
00    14        *      *    0         #Runs at 2:00 pm every Sunday
00    5          *      *    Sun     #Runs at 5:00 am every Sunday
30    8          1     *    *          #Runs at 8:30 am on the first day of every month
00    0-23/2  01   *    *          #Runs every other hour on the first of every moth
00    *           *      *    *          #Runs on every hour

 

Temporary TEMP location Change in windows for avoid space error FTP process

Temporary Change TEMP Location in Windows platform for avoid insufficient Space error in C: Drive During FTP Process

In windows, when we do any operation like download, ftp etc, Due to insufficient space in C: Drive the we got error for insufficient space.

Suppose i created one batch file as ftp job which will transfer the backup of 16 GB files from Production Server to Test Environment daily. It’s start failed due to insufficient space but on D: drive on windows have sufficient space around 100 GB.

Error occurred due to environment variable TEMP is set to default C:\temp directory which is pointing to C: Drive which is not having sufficient space to do the operation then it will generate an error of insufficient space for operation.

Solution:
You can change the temp space location temporary for any task like ftp if d drive have enough space

set temp= D:\
set tmp=D:\

 
You can set this parameter temporary before the operation start for session level or used it in batch files for batch operation.
 

Disk Space monitor script in linux

Disk Space Monitoring Script for Linux Operating system

When ever disk space is going to low the following script will send a mail to the user show disk space low at which hostname and disk.

Script:


#!/bin/sh
#=================================================================================================
# Script Title  : Disk Space Monitoring
# Version       : 1.0

# Purpose       : Shell script to monitor disk space
# It will send an email to provided email IDs, if available percentage of free space is > /tmp/diskspace/space.txt
        echo "Date- $dt" >> /tmp/diskspace/space.txt
        echo "IP Address -`/sbin/ifconfig | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})'`"  >> /tmp/diskspace/space.txt
        echo "Hostname - $(hostname)"  >> /tmp/diskspace/space.txt

df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output;
do
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )
# Checks if disk free is between 75% and 85%
  if [ $usep -gt 75 ] && [ $usep -le 85 ]; then
        echo "File System -$partition"  >> /tmp/diskspace/space.txt
        echo "Percent Used - $usep%"  >> /tmp/diskspace/space.txt
mailx -s "WARNING !! Low disk space on $(hostname)- $(date)" $EMAIL  > /tmp/diskspace/space.txt
        echo "Percent Used - $usep%"  >> /tmp/diskspace/space.txt
mailx -s "CRITICAL !! Low disk space on $(hostname)- $(date)" $EMAIL  > /tmp/diskspace/space.txt
echo "Percent Used - $usep%"  >> /tmp/diskspace/space.txt
mailx -s "HIGH CRITICAL !! Low disk space on $(hostname)- $(date)" $EMAIL  < space.txt
        fi
    fi
done