Apr 17 2017

Find And Delete Files Greater Than Given Size on Linux

Category: Linux & UnixFatih Acar @ 19:56

If you want to delete files which are greater than given size on Linux, you can use below examples by changing as your need.

Delete Files

Delete files which are size more than 2 MB. and type is jgp.

[root@testserver ~]# find /tmp/ -type f -size +2M -name “*.jpg” -exec rm -rf {} \;

Delete files which are size more than 2 MB low than 5 MB. and type is jpg.

[root@testserver ~]# find /tmp/ -type f -size +2M -size -5M -name “*.jpg” -exec rm -rf {} \;

Delete files which are size low than 10 MB. and type is zip.

[root@testserver ~]# find /tmp/ -type f -size -10M -name “*.zip” -exec rm -rf {} \;

2,500 total views, 5 views today

Tags: Linux Administration, System Administration


Dec 09 2016

Check Service Status With Python on OEL 7 / Centos 7

Category: Linux & Unix,PythonFatih Acar @ 21:42

I write a python code to check mysql service open or close. It is simple and you can change service_name parameter in the code to check another services. You can download from here check_service_status.py Below code maybe can not run because of python language format is tab structure. You can use with download original code check_service_status.py

Check MySQL Service Status


#-*- coding: utf-8 -*-

import os
import commands

service_name = "mysql"

def check_service_status(service_name):

        status = os.system('systemctl status '+service_name+ ' > /dev/null')
        return status

def main():

        if (check_service_status(service_name) == 0):
                print "Running"
        else:
                print "Stopped"
main()

Download

Execute Script
Continue reading “Check Service Status With Python on OEL 7 / Centos 7”

2,886 total views, 4 views today

Tags: Linux Administration, Python, System Administration


Nov 30 2016

Change Hostname on OEL 7 CentOS 7

Category: Linux & UnixFatih Acar @ 10:24

You can use hostnamectl command to list and change hostname of operating system on OEL 7 or CentOS 7 version.

List Hostname Status


[root@localhost ~]# hostnamectl 

   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 6f021291e2384a219e1f23ca39eadc9a
           Boot ID: ec195c69cfde417b88b86f4d7419cf24
    Virtualization: vmware
  Operating System: Oracle Linux Server 7.3
       CPE OS Name: cpe:/o:oracle:linux:7:3:server
            Kernel: Linux 4.1.12-61.1.28.el7uek.x86_64
      Architecture: x86-64

Change Hostname Status
Continue reading “Change Hostname on OEL 7 CentOS 7”

2,185 total views, 5 views today

Tags: Linux Administration, System Administration


Nov 01 2016

Change Hostname in RHEL 7

Category: Linux & UnixFatih Acar @ 10:29

Changing hostname is different from RHEL 6 version in RHEL 7. You can use few method to change hostname. I will demonstrate useful and easy method that is hostnamectl command.

Show Current Hostname

[root@localhost ~]# hostname
localhost.localdomain

or

[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 418f684e1a5c45c9a22f76065c732de3
Boot ID: 9b07d8a45e60437e9ef31164d394ad17
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.36.3.el7.x86_64
Architecture: x86-64

Change Hostname
Continue reading “Change Hostname in RHEL 7”

2,811 total views, 2 views today

Tags: Linux Administration, System Administration


Oct 31 2016

Firewalld Add New Port, List All Ports, Remove Port with firewall-cmd command in Oracle Linux 7

Category: Linux & UnixFatih Acar @ 16:32

What is firewalld

Firewalld provides a dynamically managed firewall with support for network/firewall zones that define the trust level of network connections or interfaces. It has support for IPv4, IPv6 firewall settings, ethernet bridges and IP sets. There is a separation of runtime and permanent configuration options. It also provides an interface for services or applications to add firewall rules directly.

Benefits of using firewalld

Changes can be done immediately in the runtime environment. No restart of the service or daemon is needed.

With the firewalld D-Bus interface it is simple for services, applications and also users to adapt firewall settings. The interface is complete and is used for the firewall configuration tools firewall-cmd, firewallctl, firewall-config and firewall-applet.

The separation of the runtime and permanent configuration makes it possible to do evaulation and tests in runtime. The runtime configuration is only valid up to the next service reload and restart or to a system reboot. Then the permanent configuration will be loaded again. With the runtime environment it is possible to use runtime for settings that should only be active for a limited amount of time. If the runtime configuration has been used for evaluation, and it is complete and working, then it is possible to save this configuration to the permanent environment.

firewall

Add a Port to Firewalld as temporary

[root@test ~]# firewall-cmd –add-port=1521/tcp

Add a Port to Firewalld as permanent
Continue reading “Firewalld Add New Port, List All Ports, Remove Port with firewall-cmd command in Oracle Linux 7”

5,465 total views, 14 views today

Tags: Linux Administration, System Administration


Oct 12 2016

Turkey Stay Summer Time Zone and How to Implement TZDATA Package for Linux Systems

Category: Linux & UnixFatih Acar @ 15:59

Turkey is breaking step with Europe and keeping summer time through the winter. Instead of turning clocks back an hour as they do in the European Union in the autumn, Turkey will keep the clocks as they are and effectively change the country’s time zone. You have to implement new tzdata-2016g package on your systems to accommodate new decision.

You can install from Red Hat yum repository if you use Red Hat system. (Red Hat, Centos, Oracle Linux)

https://access.redhat.com/errata/RHEA-2016:1982

yum install tzdata*2016g*

Both tzdata-java-2016g and tzdata-2016g package installation will be useful.

Check New Adjustment

You check new time zone status with zdump command like below.

zdump -c 2016,2017 -v “Europe/Istanbul”

tzdataturkey

You have not to see Oct 30 date and gmtoff value 7200. You have to see gmtoff value 10800.

6,508 total views, 4 views today

Tags: System Administration


Aug 18 2016

How to Add EPEL Yum Repository on Oracle Linux 7

Category: Linux & UnixFatih Acar @ 11:50

EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux. Epel project is not a part of RHEL/CentOS but it is designed for major Linux distributions by providing lots of open source packages like networking, sys admin, programming, monitoring and so on. Most of the epel packages are maintained by Fedora repo. Nagios packages are example in EPEL Repo.

Why we use EPEL repository?

  • Provides lots of open source packages to install via Yum.
  • Epel repo is 100% open source and free to use.
  • It does not provide any core duplicate packages and no compatibility issues.
  • All epel packages are maintained by Fedora repo.

Download EPEL Repo

Address : http://download.fedoraproject.org/pub/epel/7

Download link mirror: http://mirror.dgn.net.tr/epel//7/x86_64/e/epel-release-7-8.noarch.rpm

Install RPM

rpm -ivh epel-release-7-8.noarch.rpm

Control Epel Repo

yum repolist

Install Nagios Packages

List Nagios Packages
yum –enablerepo=epel -y list nagios-plugins*

Install Packages
yum –enablerepo=epel -y install nrpe nagios-plugins

6,599 total views, 18 views today

Tags: Linux Administration, Oracle Linux


Jan 12 2016

Oracle 11g Data Guard Failover With Python Script

Category: Administration,Backup And Recovery,Linux & Unix,PythonFatih Acar @ 10:56

I wrote a python script to perform failover steps and to take product database IP addresses when product database is down. If you dont use data guard broker or other application for failover operations, you can use this script for failover. My scenario is that I have Oracle 11gR2 2 nodes RAC product database and 1 node standby real time apply type data guard database. When the product database is fail, the data guard database can run as product database with take product database IP addresses and service name. Python script will do all steps that take product IP address, take product service name, perform failover steps.

I made test when data guard was archivelog apply type, script could run correctly.

Systems

Product Database : Oracle 11g R2 (11.2.0.3) RAC
Data Guard : Oracle 11g R2 (11.2.0.3) Single Instance With Grid Infrastructure
Operating System : Oracle Linux 6.6
Data Guard Type : Real Time Apply From Redo Logs
Script Name : failover.py

Python script file is failover.py .Firstly, we have to change parameters in script. You can use vi editor. I generally create python files under /opt/scripts directory.

failover_parameters

Script has 3 types take virtual IP process. If you can not see product virtual IP address when you run ifconfig command after run failover.py script, you can use other type virtual IP process.

The product database is fail. We have to run data guard database like product database. We can use failover.py script.

Run failover.py

[root@dg scripts]# python failover.py

runfailover

If all parameters are correct, you can write “evet” and push enter.

Continue reading “Oracle 11g Data Guard Failover With Python Script”

10,759 total views, no views today

Tags: Database Administration, Oracle Administration, Oracle Backup and Restore, Oracle Data Guard Failover, Oracle Failover


Dec 04 2015

RPM Command Using on Linux Systems

Category: Linux & UnixFatih Acar @ 15:46

If you connect linux repo, you can use yum install or yum update to manage your package. On the other hand, if you have RPM package, you can use rpm command to manage packages.

RPM command has been using for installing, uninstalling, upgrading, listing,querying and checking RPM packages on linux system. You can use rpm command with root user.

Frequently Used RPM Commands

Install RPM Package

[root #] rpm -ivh postgresql-libs-8.4.20-1.el6_5.x86_64.rpm

Update RPM Package

[root #] rpm -Uvh postgresql-libs-8.4.20-1.el6_5.x86_64.rpm

List All Installed Packages

[root #] rpm -qa

Search From Installed Packages

[root #] rpm -qa | grep postgresql-libs

Take Information From Installed Package

[root #] rpm -qi postgresql-libs

Uninstall RPM Package

[root #] rpm -ev postgresql-libs

5,202 total views, 5 views today

Tags: Linux Administration, Oracle Linux, System Administration


Nov 21 2015

How to Lock and Unlock Users on Oracle Linux / Centos / Redhat

Category: Linux & UnixFatih Acar @ 13:25

Lock User

Method 1

[root@test ~]# passwd -l username

Method 2

[root@test ~]# usermod -L username

Unlock User

Method 1

[root@test ~]# passwd -u username

Method 2

[root@test ~]# usermod -U username

Check Status of Users

[root@test ~]# more /etc/shadow

username:!!$6$pmQO0ZPH$POolvCzxe1nsd1OpLkMc6E3cd1ffOkcz224caQs1d/oL.OwscUhYfcas//41sS12.:16531:0:99999:7:::

Note : If you see “!!” expression or “!” expression start of password of username, the user is locked.

1,655 total views, 5 views today

Tags: Linux Administration, System Administration


Next Page »