Sunday, May 21, 2017

Error while starting jenkins

Today, when I install and setup Jenkins, I am getting the following error while starting the jenkins service.

OS : CentOS release 6.8 (Final)

Following is the error:

Running from: /usr/lib/jenkins/jenkins.war
May 21, 2017 7:38:37 PM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
Jenkins requires Java7 or later, but you are running 1.7.0_131-mockbuild_2017_02_13_15_19-b00 from /usr/lib/jvm/java-1.7.0-openjdk-
java.lang.UnsupportedClassVersionError: winstone/Launcher : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(
        at Method)
        at java.lang.ClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at Main._main(
        at Main.main(

Solution to fix the issue:

1. Take the backup of /etc/init.d/jenkins to a safe location.
2.  update-alternatives --config java (to the latest java) 
3. Update the file /etc/init.d/jenkins after candidates with your result of echo $JAVA_HOME

The  /etc/init.d/jenkins snippet is below
# Search usable Java as /usr/bin/java might not point to minimal version required by Jenkins.
# see

4. Restart jenkins

Tuesday, May 2, 2017

Patching 0 for a variable in python

As part of a program logic, i need to patch 0 for a variable to make sure the total length of the string is 3.

Here the variable name is shivin

shivin = shivin.zfill(3)
return shivin

Wednesday, April 5, 2017

How to sort the contents of a file in linux

How to sort the contents of a file in linux

I have a file in a path /tmp which contains some rpm packages. I need to sort the file.

ll /tmp/pckg.txt
sort /tmp/pckg.txt > /tmp/s_pckg.txt
A new file /tmp/s_pckg.txt will be created and the contents in that file will be in sorted order.

sort -r /tmp/pckg.txt > /tmp/s_pckg.txt
Reverse sorted.

sort -nk2 /tmp/s_pckg.txt
On the basis of second column it will sort.

Useful command combination in System Administration

Useful command combination in System Administration

Once you are in a linux box, these commands will help you to save your time a lot.

[root@linuxblack tmp]# ps aux|grep nagios | awk '{print $2}'|xargs kill -9 to kill the process owned by nagios

[root@linuxblack tmp]# ll | grep 02:1| awk '{print $9}'| xargs gzip list and zip the files in a dir whose time is 02:1

[root@linuxblack tmp]# ll | grep Jul| awk '{print $9}'| xargs du -hs - list and display the disk usage

[root@linuxblack tmp]# lsof -i TCP:443|awk '{print $2}'|xargs kill -9 Kill the process listening on port 443

How to move a linux process to foreground and background

How to move a linux process to foreground and background

I started a java process (not using &), but i need to move that process to background and foreground.

1. First I stopped the process using CTRL+Z ,
2. I do a process grep and i could see its running, (ps aux|grep java)
3. I issues command "jobs", it return me a job ID.

Example : - In this case job id is : 1
-bash-4.1$ jobs
[1]+ Stopped java -jar

4. Command -bash-4.1$ fg 1 (will bring the job id 1 to foreground)
5. Command -bash-4.1$ bg 1 (will move the job id 1 to background)

How to move a website from one cpanel to another cpanel server

How to move a website from one cpanel to another cpanel server

Our requirement is to migrate a full website from old cpanel server to new cpanel server. This has to be done in command prompt.

Follow the steps:

1. Login to the old cpanel server as root.
2. Backup the whole website using the command: /scripts/pkgacct {cpanel_username}
3. It will create the backup in /home folder as /home/cpmove-cpanelusername.tar.gz
4. Copy the backup file to the new server: scp /home/cpmove-cpanelusername.tar.gz
5. Login the new server as root.
6. Verify the size of the backup files.
7. It's the time to restore the backup in new server: /scripts/restorepkg {cpanel_username}
8. This will help to re-create everything from old server to the new server.
9. Test and verify, then go ahead in changing the DNS.

Mattermost Error: MySQL FULLTEXT indexes issue in logs

Mattermost Error: MySQL FULLTEXT indexes issue in logs

While working on Mattermost in my local machine I got the following error:


Solution for fixing the issue is:

1. Login the server
2. Login to the mysql prompt:
show table status;
3. There you can see all the tables are having Engine as MYISAM.
4. You need to update those tables as INNODB

This helped to solve the issue.

Scenario based VMware questions

Scenario based VMware questions

1. Which method you adopt for taking backup of ESXi configuration ?
2. vMotion failed at 27%. What could be the possible reasons ?
3. What could be the reason for failing a VM to start after moving from another VMware platform ?
4. Can we clone a VM without VCenter ?
5. What are the possible reasons for ESXi host shown as disconnected in vCenter ?
6. After VMware clone Redhat network interface is not detecting, what may be the reasons ?
7. How can we resize an IDE virtual disk in VMware ?
8. What could be the reason for Software iSCSI adapters are not visible ?
9. What could be the reason for "Cannot create VMs with virtual machine version 9 in ESXi" ?
10. How to extend a logical volume in Windows 2003 hosted in VMware ?
11. What are the different ways to shrink the size of a vmdk file ?
12. Application server hosted in VMs are facing performance degradation. How to confirm whether it is an application related issue or VMware related issue ?
13. How to remove iscsi targets from ESXi with 'Dead' or 'Error' status ?
14. Reclaim the size of a thin provisioned vmdk file ?
15. What are the possible reasons for the operation to resize a VM disk failed ?
16. What could be the reason for "VM appears as inaccessible in vCenter" ?

Tuesday, April 4, 2017

Search and Replace in Vi editor


I have a file called main.html, I need to search and replace _output with OUTPUT.


Open the file in vi editor - vi main.html
Save file

The :substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want:

    Find each occurrence of 'foo' (in all lines), and replace it with 'bar'.

    Find each occurrence of 'foo' (in the current line only), and replace it with 'bar'.

    Change each 'foo' to 'bar', but ask for confirmation first.

    Change only whole words exactly matching 'foo' to 'bar'; ask for confirmation.

    Change each 'foo' (case insensitive due to the i flag) to 'bar'; ask for confirmation.
    :%s/foo\c/bar/gc is the same because \c makes the search case insensitive.
    This may be wanted after using :set noignorecase to make searches case sensitive (the default).

    Change each 'foo' (case sensitive due to the I flag) to 'bar'; ask for confirmation.
    :%s/foo\C/bar/gc is the same because \C makes the search case sensitive.
    This may be wanted after using :set ignorecase to make searches case insensitive. 

Thursday, March 16, 2017

What is DevOps?

What is DevOps?

Devops = Development + Operations

DevOps is a framwork which integrates the Development team, QA and Operations. It's a collaboration effort to make the software delivery smooth.

Values of Devops
Following are the values of DevOps, that make it a success.

- Culture
- Automation
- Measurement
- Shairing

Devops Methodology

First Methodology - People over Process then selecting Tools
Second Methodology - Continues Devlivery
Third Methodology - Lean Management
Fourth Methodology - Change Control
Fifth Methodology - Infrastructure as Code

10 Pratices that drives DevOps to success
Following ten practices helps the DevOps to success in your organization.

1. Chaos Monkey
2. Blue/Green Deployment
3. Dependency Injection
4. Andon Cards
5. The Cloud
6. Embedded teams
7. Blameless postmortems
8.Status pages
9.Developers on call

Six practices that are important for CI

1.Build should pass the coffee test (<5 min)
2.Commit really small bits
3.Don't leave the build broken
4.Use  a trunk-based development flow
5.Don't allow flaky tests. Fix them!
6.The build should return a status, a log, and an artifact.

Friday, March 10, 2017

/usr/bin/env: ‘node’: No such file or directory

I got this error when I tried to install Hubot


/usr/bin/env: ‘node’: No such file or directory


ln -s /usr/bin/nodejs /usr/bin/node

root@mybot:/opt/hubot# ./bin/hubot
/usr/bin/env: ‘node’: No such file or directory
root@mybot:/opt/hubot# ln -s /usr/bin/nodejs /usr/bin/node
root@mybot:/opt/hubot# ./bin/hubot

Tuesday, February 14, 2017

How to create a Junit test case with failure

Today for testing, I need to create a junit test case xml file. Here is the sample which helps to create this failure xml.

<testsuite tests="3">
    <testcase classname="foo1" name="ASuccessfulTest"/>
    <testcase classname="foo2" name="AnotherSuccessfulTest"/>
    <testcase classname="foo3" name="AFailingTest">
        <failure type="NotEnoughFoo"> details about failure </failure>
This helps me to create a test.xml file having a failure in test case.