Wednesday, June 17, 2015

NTP leap second fix - Red Hat stuff

Resolve Leap Second Issues in Red Hat Enterprise Linux

Leap seconds are a periodic one-second adjustment of Coordinated Universal Time(UTC) in order to keep a system's time of day close to the mean solar time. However, the Earth's rotation speed varies in response to climatic and geological events, and due to this, UTC leap seconds are irregularly spaced and unpredictable. This article seeks to provide information regarding the leap seconds themselves, along with addressing how Red Hat Enterprise Linux handles the insertion of one.

The next leap second insertion is scheduled for June 30th, 2015 at 23:59:60 UTC.

Systems running any version of Red Hat Enterprise Linux should automatically account for leap second corrections if they are using the NTP (Network Time Protocol) daemon to synchronize their local timekeeping with an NTP server. During the last day before a leap second correction, NTP servers should notify their clients that a leap second will occur, and at 23:59:59 UTC, the Linux kernel should add or remove an extra second by making the 60th second occur twice or removing it entirely.

Tuesday, May 26, 2015

Delete the file and checking the error status - shellscript

This script uses command line arguments ($1 and  $?) and tail out the /root/error.txt file.

#!/bin/bash
#usage of command line arguments
rm $1 2>>/root/error.txt
if [ $? -eq 0 ]
then
echo " Success "
else
tail -1 /root/error.txt
fi

Sleep command - an example shell script

The following script clear screen and update the date every second. So it seems like the running digital clock.

#!/bin/bash
#running digital clock
while [ : ]
do
clear
date
sleep 1
done

Saturday, May 23, 2015

Simple one line script for checking the file existence.


A single line script / command to find the particular file exists or not.
# test -f a.txt && echo "File exists" || echo "File does not exist"

Simple shell script to find out the file exists or not

Script
#!/bin/bash
#name: filecheck.sh
#simple script to find out the file exists or not
if [ -f $1 ]
then
echo " $1 exists "
else
echo " $1 does not exist"
fi
Script usage: ./filecheck filename

Ubuntu 15.04 general features

Well, here we are. After six busy months, one beta and a bunch of minor changes, the final stable release of Ubuntu 15.04 is now ready for you to download.

The bug fixes, improvements in usability and a fresh serving of software updates add up to a somewhat substantive total, creating a release that feels more polished than ever.

Enough chatter. Let’s dive in and see what’s new in Ubuntu 15.04.

Ubuntu 15.04 – New Features

Systemd
‘You may notice a change in boot speed [because of Systemd]…’
The headline change in Ubuntu 15.04 is the introduction of the Systemd init system at boot-time.

This is the software that initializes (hence the name ‘init’) first when booting, and handles loading of the various modules and background processes that make much of a modern computer operating system do what it needs to.

Ubuntu previously used Upstart, its own custom-made Init system, at boot time. When Debian, the Linux distribution that Ubuntu is built upon, chose to adopt Systemd Ubuntu understandably fell in line.

Upstart is available in 15.04. It’s included as a fallback in GRUB and is used for controlling user sessions.

The merits (or lack thereof) of the switch are largely moot for the less technically minded. It is possible that some users will notice a slight change in boot speed depending on their configuration.

Unity 7.3
Locally Integrated Menus Are Now Default
Menus can now be set to ‘always show’
The Unity desktop environment used by default in Ubuntu 15.04 receives a handful of small refinements, most of which aim to either fix bugs or correct missteps in earlier versions.

For example, application menus can now be set to ‘Always Show’.

Yeah; you no longer have to push your mouse to the top of the screen to show the ‘File’, ‘Edit’, ‘Help’, etc menus — not if you don’t want to.

If you prefer having your applications menus available inside application windows use the toggle in System Settings > Appearance > Behaviour to set things up how you like.

These “locally integrated menus”, introduced in 14.10, also support the ‘Always Show’ feature and showing up on mouseover of unfocused windows.

Other improvements to Unity in Vivid Vervet include a fix for showing the overlay elements (HUD, Dash, etc) over fullscreen windows and small adjustments to the speed of login and logout animations.

Compiz 0.9.12
Powering the Unity desktop experience is Compiz, the tried-and-trusted window manager. In keeping with the rest of this release the changes it gets are modest and made up of bug fixes and compatibility with alternative desktop environments.

Ubuntu Linux Kernel 3.19
While not based on the latest version of the Linux Kernel Ubuntu 15.04 ships with a modified version of 3.19.3 one. Expect a few updates to the most recent 3.19.x patch releases shortly after release.

Application Updates
music-rhythmbox
New and updated apps feature, including Rhythmbox
You’ll also find updated versions many of Ubuntu’s default apps, including the latest Firefox web-browser and Thunderbird e-mail client, a new version of the Rhythmbox music player plus an entirely revamped Totem video player.

LibreOffice 4.4
Firefox 37
Thunderbird 31.6
Shotwell 0.20.2
Nautilus 3.14.2
Evince 3.14.2
Rhythmbox 3.1
Totem 3.14.1
GNOME Terminal 3.14
New Default Wallpaper
suru desktop wallpaper ubuntu vivid

The new Ubuntu 15.04 Wallpaper
Ubuntu’s default wallpaper choice is irrelevant to some, integral to others. Whatever side of the fence you sit on the new wallpaper is palatable enough. After all: first impressions count.

Expect to see this new design flash up in various ‘Ubuntu in the wild’ posts over the next six months!

Ubuntu Make
Having been formally introduced in last October’s release the ‘Ubuntu Developer Tools Center’ has undergone a number of changes for Vivid, including being renamed as the more memorable ‘Ubuntu Make’.

Ubuntu Make simplifies the process of installing a host of developer-focused tools, editors, libraries and software development kits including the Android SDK, IDEA, PyCharm, and the new Firefox Developer Edition.


Improvements to the way library managers behave now allows multiple system libraries to be run/used without conflict.

Linux interview questions - UCF3.2 special

  1. SSH connection refused –start the sshd service in client side
  2. Fsck usage
Q. Can I run fsck or e2fsck command when Linux file system is mounted? Do you advice to run fsck on a live file system? I am using Cent OS.
A. No. Do not run fsck on a live or mounted file system. fsck is used to check and optionally repair one or more Linux file systems. Running fsck on a mounted filesystem can usually result in disk / data corruption. So please do not do it. You have two choices
(a) Take down system to single user mode and unmout system
  1. Xfs port number 7100
  2. iptables –F flushing iptable rules
  3. Sendmail configuration file /etc/mail/sendmail.cf,
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  1. No of hosts in class b
Address Class
Total # Of Bits For Network ID / Host ID
First Octet of IP Address
# Of Network ID Bits Used To Identify Class
Usable # Of Network ID Bits
Number of Possible Network IDs
# Of Host IDs Per Network ID
Class A
8 / 24
0xxx xxxx
1
8-1 = 7
27-2 = 126
224-2 = 16,277,214
Class B
16 / 16
10xx xxxx
2
16-2 = 14
214 = 16,384
216-2 = 65,534
Class C
24 / 8
110x xxxx
3
24-3 = 21
221 = 2,097,152
28-2 = 254


  1. What is the default permission for printer spooler service?
620 – read write – write- no perminssion
  1. File string delete – sed command
  2. What is the advantage of N+1 and one to one cluster?
The advantages of the N + 1 model are that the server load can be distributed to multiple nodes and that only one backup node is necessary to sustain all the possible node failures. Thus, the machine idle ratio is 1/N as opposed to 1/1, as is the case in a single asymmetric model.


Table 3-1  High Availability Model Advantages and Disadvantages
Model
Advantages
Disadvantages
Recommended User
Asymmetric
  • Simple Configuration
  • Backup node is 100 percent reserved
  • Machine resources are not fully utilized
A small service provider with plans to expand in the future.
Symmetric
  • Better use of system resources
  • Higher availability
  • Resource contention on backup node
  • Mirrored disks reduce disk write performance
A medium-sized service provider with no expansion plans on their backup systems in the near future.
N + 1
  • Load distribution
  • Easy expansion
  • Configuration complexity
A large service provider who requires distribution with no resource constraints.


  1. Block level for NAS (Network Attached SCSI) NAS is file level, SAN & DAS are block level
  2. Which cluster has the critical application? Application cluster
  3. What is the security protocol in SAN? LUN masking, zoning - In a storage area network (SAN), zoning is the allocation of resources for device load balancing and for selectively allowing access to data only to certain users.
  4. ls *.txt
  5. iostat which field the processing of time waiting ? 4 th field %iowait
  6. rpm to deb what is the package? alien rpm
  7. How to find send/receive of eth0 statistics? ethtool -S eth0, netstat -e
  8. What is not a routable protocol? Bootp, tcp, arp, rarp
  9. CD drive protocol – ATAPI (ATA Packet Interface)
  10. What is the single point of failure in cluster network?
A single point of failure (SPOF) is a part of a system that, if it fails, will stop the entire system from working.[1] They are undesirable in any system with a goal of high availability or reliability, be it a business practice, software application, or other industrial system.
Systems can be made robust by adding redundancy in all potential SPOFs. For instance, the owner of a small tree care company may only own one wood chipper. If the chipper breaks, he may be unable to complete his current job and may have to cancel future jobs until he can obtain a replacement.
Redundancy can be achieved at various levels. For instance, the owner of the tree care company may have spare parts ready for the repair of the wood chipper, in case it fails. At a higher level, he may have a second wood chipper that he can bring to the job site. Finally, at the highest level, he may have enough equipment available to completely replace everything at the work site in the case of multiple failures.
The assessment of a potential SPOF involves identifying the critical components of a complex system that would provoke a total systems failure in case of malfunction. Highly reliable systems should not rely on any such individual component.


  1. File which is accessible by any process? lsof,top,ps,all the above
  2. echo ENV_VAR what is the output? Same output
  3. iostat –x What is the output? Disk utilization in linux
  4. need to forward mails
.forward
  1. send mail alias file? /etc/aliasis
  2. What is the maxpv size in LVM? 2TB PE size 4MB
  3. Where we install platform in the cloud?Infrastructure or platform
  4. NTP expansion – Network Time Protocol (123-port no)
  5. Advantages of LVM2 (read & write and snapshot)
  6. Partition type of lvm – partition id 08e
  7. Authorize server usage in DNS – Master/ slave a &b
  8. Not included in DNS = restricted zero/ standard primary
  9. Not benefits in clouding = regulatory
  10. 3rd party / partners in for incident report
  11. Password reset is incident management true
  12. Commands to display vgs – vgs, vgdisplay
  13. How to run bourne again scripts ./scriptname.sh
  14. 2 types of zoning in storage – hard zone and soft zone
  15. Command to list route – route –n, netstat –r
  16. Merits of resizefs over ext2 – revision control
  17. One public network down what to do? Remedy
Additional questions:1) How to reduce the lvm, or How to reduce vg? lvreduce -L -200G /dev/vg0/lv0
2) What is the layer nfs supported? Application layer
3) What is the configuration file for squid? /etc/squid/squid.conf
4)Which class multicast is supported class D
5)What is the port no for NIS and NFS ? NFS 2049 NIS
6) How to exit the crontab with saving the command?esc:wq
7) crontab entries – min hours date month day command
8) DNS config file /var/named/chroot/etc
9) What is the use of DAS? Direct-attached storage (DAS) is computer storage that is directly attached to one computer or server and is not, without special support, directly accessible to other ones.
10) How to check the socket details? lscpu | grep 'socket' dmidecode


Other questions:

    1. How to disallow the query from DNS? RFC 1035 transaction signature
    2. How to delete package using dpkg? dpkg –r package name
    3. What is the reconfiguration file in RHEL? sys-unconfig
    4. Block size 8192 mount thru NFS? mount moonshot:/home /home -o rsize=8192,wsize=8192
    5. What is lsof option for subdirectories? lsof +D /directory
    6. xinetd or inetd file for RHEL
    7. default protocol for traceroute ICMP
    8. iostat –d? Only device statistics will be displayed.
    9. How to check sockets thru netstat? netstat -an or lsof -i.
    10. How to check non-listening sockets thru netstat? netstat -al
    11. Highly availability cluster in patching and upgrading?
    12. What is a valid FC topology? Switched fabric
    13. Protocol for TCP/IP? internet
    14. Service desk – for problem analysis and solution providing – False



  1. HBA expansion – Host Bus Adapter
  2. How to check the hops? Traceroute
  3. Incident management and problem management example.
  4. Lvmmaxpvsize=0 what does it mean?
  5. Hybrid cloud concept? A hybrid cloud is a cloud computing environment in which an organization provides and manages some resources in-house and has others provided externally.
  6. OSI & TCP how many layers? 7 & 4 layers respectively
  7. To insert above and below one line in the vi editor esc O/o (capital – above, small – below)
  8. To replace the character? r
  9. Priority – nice value -20 to 19 (lower number has higher priority, 0 is default priority)
  10. What are the ways to change the hostname in RHEL? hostname =hostname, /etc/sysconfig/hostname
  11. How to connect external DAS? The main protocols used for DAS connections are ATA, SATA, eSATA,[1] SCSI, SAS, and Fibre Channel.
  12. What are the things to be mentioned in iSCSI
  13. How to avoid bounced mail in sendmail?
  14. How to avoid mail queue in sendmail?
  15. How to extend lv in linux 2.6 kernel in lvm2 from 12 to 13 gb? lvextend –L +1G /dev/vg0/lv0
  16. 4Gb – 4096Mb
  17. HA cluster, I/O fencing two nodes failed? Fail-over - the operation of moving the service from one cluster node to another.
  18. How to avoid split brain? A good way of avoiding split brain conditions in most cases without having to resort to fencing is to configure redundant and independent cluster communications paths - so that loss of a single interface or path does not break communication between the nodes - that is the communications should not have a single point of failure (SPOF).
  19. VLAN advantage in SCSI?


  1. Split
split -b 22 newfile.txt new
Split the file newfile.txt into three separate files called newaa, newab and newac..., with each file containing 22 bytes of data.
split -l 300 file.txt new
Split the file newfile.txt into files beginning with the name new, each containing 300 lines of text.


  1. How to find the hard link of a particular file
— Test: -samefile NAME
File is a hard link to the same inode as NAME. If the ‘-L’ option is in effect, symbolic links to the same file as NAME points to are also matched.


— Test: -inum n
File has inode number n. The ‘+’ and ‘-’ qualifiers also work, though these are rarely useful. Much of the time it is easier to use ‘-samefile’ rather than this option.


  1. Apache directive
Apache directives are a set of rules which define how your server should run, number of clients that can access your server, etc. you can change them by editing the httpd.conf and related files to meet your requirements
  1. How to delete a character in vi editor – press x to delete
  2. Grep pattern – filtering a text from the file in general
  3. How to disconnect the users
skill -STOP -u vivek stop the user
skill -CONT -u vivek resume the halted user
  1. How to set numbers in vim esc: se nu
  2. Broadcast ip address – last address of the class
  3. How to add nfs wherever needed – nfs soft mount to be used
  4. Packages/modules for ldap – open ldap
  5. Mac address how many bit – 48 bits
  6. What is UTC – Universal co-ordinate time
  7. Vmstat syntax - vmstat [options] [delay [count]]
  8. iostat once 5 times - iostat 5
  9. Routing table – route –n, netstat –rn, ip route list
  10. Features of NAS
NAS operates at file system level -- usually either NFS or CIFS -- and serves whole files to users over the shared medium of the local-area network (LAN), while storage-area networks (SANs) deliver data at the block level (via Fibre Channel or iSCSI protocols) and are well suited to transactional storage such as database access.
  1. Iscsi protocol? – internet protocol, SAN protocol